title: How to group by 2 fields and order by date at the same time?
body: <p>I have 3 fields in an <code>employees</code> table: <code>personal_id</code>, <code>personal_id_type</code>, and <code>date_registered</code>.</p>
  
  <p>I need to find all the rows, one row for each <code>personal_id + personal_id_type</code> (here is where I think I can use a GROUP), but since there may be many entries for the same <code>personal_id + personal_id_type</code> (because employees can quit and get hired again later), I need to fetch only the newest entry (<code>order by date_registered DESC</code>).</p>
  
  <p>Is this conceptually correct? What would be the syntax for grouping by 2 fields? Will I achieve what I need with that?</p>
  
  <p>Edit: I'm sorry, actually there are a lot of fields, so I need the newest row, not only the newest date.</p>