title: Oracle SQL - How to get the assignment id of the record with the maximum date
body: <p>I'm trying to get the assignment id of the employee who was the last occupant of the position. That would be the last assignment who had the position or the maximum date. How can I retrieve both in the below query?</p>
  
  <pre><code>select max(to_char(paaf.effective_start_date, 'yyyymmdd')) || to_char(paaf.assignment_id)
  from   apps.per_all_assignments_f paaf
  where  paaf.position_id = 159841 
  and    paaf.assignment_type in ('E', 'C')
  and    paaf.primary_flag = 'Y'
  </code></pre>
  
  <p>I'm converting the maximum date to a character in order to substring it out in the result.</p>