I have a table like below
id value date
abc -0.4 2021-03-03
def 0.2 2021-09-09
abc 3.3 2000-01-01
I need to delete any ids that appear more than once but keep the record that has the latest date. So for eaxmple I want to run a query that would leave me a table like below,
id value date
abc -0.4 2021-03-03
def 0.2 2021-09-09
How do I write a delete query to delete records where the id exists more than once but keep the latest record?