title: How to deal with union/order by differences between HSQLDB and MySQL?
body: <p>I am currently using hsqldb for testing and mysql for production. This combination has worked great for me on every recent project, but I've come across a situation where HSQLDB's syntax/dialect is different from MySQL, and I'm not really sure what the best strategy is to overcome it.</p>
  
  <p>In mysql, you can write a union query like this:</p>
  
  <pre><code>select ...
  union
  select ...
  order by created_on desc
  limit 20 offset 0
  </code></pre>
  
  <p>However, in HSQLDB, it complains that <code>order by</code> clause has an error.</p>
  
  <p>Is there any way I can write the query so that both databases like the syntax?</p>