How to delete all other distinct rows except first one.

 

If I have a table with rows

 

ID, NAME

 

1, SOME NAME

2, SOME NAME

3, SOME NAME

4, ANOTHER NAME

5, ANOTHER NAME

 

 

The delete should work even if you don't know what the value of name is,
so simply for anything that is duplicate.

 

The distinct delete should delete rows 2, 3, 5 and just keep 1 and 4, is
there a single SQL statement that can achieve this?

 

Thanks

Reply via email to