title: ORDER BY With possible missing column
body: <p>I have this DB with 2 fields, updateDate, and createDate, pretty self explanatory.</p>
  
  <p>Now, my issue is that updateDate might not exist at times, and just a createDate.
  I want to order by newest date, but I can't seem to find a way to order correctly, my first approach was to do the following:</p>
  
  <pre><code>ORDER BY
  CASE 
  WHEN "updateDate" = '' THEN "createDate"
  ELSE "updateDate"
  END
  DESC
  </code></pre>
  
  <p>And this partially works, it gives priority to updateDate, and then sorts by createDate.
  However, the issue occurs that it gives priority to sorting by updateDate, and then by createDate (Not entirely wrong, updateDate should have priority over createDate on the same date), so if there was a createDate with no updateDate newer than the updateDates, it will be placed at the bottom anyway like this:</p>
  
  <pre><code>Item | updateDate | createDate
  1       24/1/2019     1/1/2005
  2       23/1/2019     1/1/2005
  3       22/1/2019     1/1/2005
  4                    23/1/2019
  5                    22/1/2019
  </code></pre>
  
  <p>How should I do this so it sorts like this?</p>
  
  <pre><code>Item | updateDate | createDate
  1       24/1/2019     1/1/2005
  2       23/1/2019     1/1/2005
  4                    23/1/2019
  3       22/1/2019     1/1/2005
  5                    22/1/2019
  </code></pre>
  
  <p>Thanks</p>
  
  <p>EDIT: The SQL engine is SAP HANA, which is kind of undocumented, but from my testing, regular SQL like MySQL should work.</p>