We Recommend

SQL Cookbook SQL Cookbook
Written in O'Reilly's popular Problem/Solution/Discussion style, the SQL Cookbook is sure to please. Anthony's credo is: "When it comes down to it, we all go to work, we all have bills to pay, and we all want to go home at a reasonable time and enjoy what's still available of our days." The SQL Cookbook moves quickly from problem to solution, saving you time each step of the way.


Posted By

andyhartleeds on 11/06/07


Tagged

mysql database select sql order UNION BY ordering


Versions (?)


Ordering multiple SELECT statements in a UNION


Published in: SQL 


  1. (SELECT a FROM t1 WHERE a=10 AND B=1)
  2. UNION
  3. (SELECT a FROM t2 WHERE a=11 AND B=2)
  4. ORDER BY a LIMIT 10;

Report this snippet 

You need to login to post a comment.