Skip to content
Advertisement

There are duplicate records in table, we need to select only the latest records as per date using group by or window function in sql

There are duplicate records in table, we need to select only the latest records as per date using group by or window function in sql

code:

Advertisement

Answer

You can simply use a GROUP BY like so

If you want to use ROW_NUMBER you have to PARTITION BY the id

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement