title: Can I write an SQL query to filter duplicate entries of a combination of columns?
body: <p>I have found answers regarding searching for duplicates of an entry in one column, but I want to search for duplicates of a combination of entries of two columns.</p>
  
  <p>I have the columns 'Area', 'Status', and 'Update Date' as parts of my table. There are 3 different areas and 2 statuses, but there are duplicates among combinations. By that, I mean that (area1,status1) could have been updated at times t1, t2, and t3. I want to find the earliest instance (first entry in the Update Date column) FOR EACH (area,status) combination for a total of 6 rows in my output. Is this possible?</p>
  
  <p>For example, for this one _id, I need 6 rows. The code below outputs a table of 12 rows for the given _id because there are (area,status) duplicates:</p>
  
  <pre><code>select _id, area, status, update_date from history
  where area in ('a', 'b', 'c')
          and status in ('done','pending') and request_id = 123
  order by update_date desc
  </code></pre>
  
  <p>EDIT: Sorry. I know this is confusing. I'll write it out the long way to hopefully clear things up. For _id1, I need the most up-to-date (a1,s1), (a1,s2), (a2,s1), (a2,s2), (a3,s1), and (a3,s2). Then I need those for _id2, then _id3, and so on.</p>
  
  <p>Hope that makes sense and helps a bit more.</p>