0

In this sql table

enter image description here

I would like to group on fields A and B.

SELECT A, B, count(*) from table
GROUP BY A,B

However, my table has duplicates with different vintages.

How would I modify this query to select only the most recent Data Vintage within each group object and end up with

enter image description here

rightsized
  • 130
  • 1
  • 8
  • 1
    Solutions could vary depending on RDBMS (not tagged) but does this answer your question? [Get top 1 row of each group](https://stackoverflow.com/questions/6841605/get-top-1-row-of-each-group) – Stu Feb 07 '22 at 17:55
  • Looks like @Ariel' s answer will work. Thanks! – rightsized Feb 07 '22 at 18:08

0 Answers0