title: How to use ORDER BY inside UNION
body: <p>I want to use ORDER BY on every UNION ALL queries, but I can't figure out the right syntax. This is what I want:</p>
  
  <pre><code>(
  SELECT id, user_id, other_id, name 
  FROM tablename 
  WHERE user_id = 123 AND user_in IN (...) 
  ORDER BY name
  )
  UNION ALL
  (
  SELECT id, user_id, other_id, name 
  FROM tablename 
  WHERE user_id = 456 AND user_id NOT IN (...) 
  ORDER BY name
  )
  </code></pre>
  
  <p>EDIT:
  Just to be clear: I need two ordered lists like this, not one:</p>
  
  <p>1
  2
  3
  1
  2
  3
  4
  5</p>
  
  <p>Thank you very much!</p>