I have a table like:
name - log - date - dataFields john - 2 - 21/03/2014 - 123 john - 2 - 22/03/2014 - 345 john - 2 - 23/03/2014 - 234 karl - 2 - 20/03/2014 - 789 liam - 1 - 20/03/2014 - 135 liam - 2 - 21/03/2014 - 321 mick - 1 - 20/03/2014 - 987 mick - 1 - 21/03/2014 - 123 mick - 2 - 22/03/2014 - 456 mick - 3 - 20/03/2014 - 789 mick - 3 - 24/03/2014 - 456
I want to delete all records except the latest name/log combination. So in the example I'm left with
john - 2 - 23/03/2014 - 234 karl - 2 - 20/03/2014 - 789 liam - 1 - 20/03/2014 - 135 liam - 2 - 21/03/2014 - 321 mick - 1 - 21/03/2014 - 123 mick - 2 - 22/03/2014 - 456 mick - 3 - 24/03/2014 - 456
I've tried using a subquery that selects the records I want to keep. Then using not exists to select the records I want to delete, but it doesn't select any records. Can I use not exists in this way?