title: Oracle Nulls First
body: <p>I need help with sorting results of a query on Oracle where I need NULLS to be at the top.</p>
  
  <pre><code>MIN(SYSDATE - expiry) KEEP (DENSE_RANK FIRST ORDER BY SYSDATE - expiry DESC NULLS FIRST) AS active
  </code></pre>
  
  <p>The result for that goes something like:</p>
  
  <pre><code>ID      NAME               ACTIVE
  =================================
  4       John Smith         139
  4       John Smith         NULL
  4       John Smith         2700
  7       Martha Snow        NULL
  </code></pre>
  
  <p>I want it so that it will sort the result like so:</p>
  
  <pre><code>ID      NAME               ACTIVE
  =================================
  4       John Smith         NULL
  4       John Smith         139
  4       John Smith         2700
  7       Martha Snow        NULL
  </code></pre>
  
  <p>Thanks to those who will help!</p>