title: Combining UNION ALL and ORDER BY in Firebird
body: <p>This is my first attempt at answering my own question, since someone may well run into this and so it might be of help. Using Firebird, I want to combine the results of two queries using UNION ALL, then sort the resulting output on a given column. Something like:</p>
  
  <pre><code>(select C1, C2, C3 from T1)
  union all 
  (select C1, C2, C3 from T2)
  order by C3
  </code></pre>
  
  <p>The parentheses came from valid syntax for other databases, and are needed to make sure the arguments to UNION ALL (an operation that's defined to work on tables - i.e. an <i>unordered</i> set of records) don't try to be ordered individually. However I couldn't get this syntax to work in Firebird - how can it be done?</p>