Let's say I have the following table, where some rows have a duplicate some_date
value (like the first three ones in this case) while having different total
values.
| some_date | total |
| ---------------- | -------- |
| 2020-02-09 00:00 | 1.98132 |
| 2020-02-09 00:00 | 11.95332 |
| 2020-02-09 00:00 | 16.95012 |
| 2020-02-16 00:00 | 17.38212 |
What I'm trying to do is to delete rows with a duplicate some_date
value, while keeping the row with the highest total
value. In the above table, only the third and fourth row should remain, for example.
How can this be done in SQL?