title: Oracle select most recent date record
body: <p>I am trying to find the most recent record based on a date field.  When I set latest = 1 in the where clause, I get an error.  Please help if possible. DATE is a the field I'm sorting by. I have tried both latest = 1 and latest = '1'</p>
  
  <pre><code>SELECT 
  STAFF_ID,
  SITE_ID,
  PAY_LEVEL,
  ROW_NUMBER() OVER (PARTITION BY STAFF_ID ORDER BY DATE DESC) latest
  
   FROM OWNER.TABLE
  WHERE   END_ENROLLMENT_DATE is null 
  AND latest = 1
  </code></pre>