Given the following table:
+----+--------+--------+------------+
| id | val1 | val2 | timestamp |
+----+--------+--------+------------+
| 1 | 50 | 100 | 1471869500 |
| 2 | 50 | 100 | 1471869800 |
| 3 | 60 | 70 | 1471864400 |
| 4 | 60 | 80 | 1471863300 |
| 5 | 60 | 90 | 1471862200 |
| 6 | 60 | 100 | 1471861100 |
+----+--------+--------+------------+
I want to remove any rows that have duplicate values in columns val1 and val2 (so that would be rows 1 and 2) but keep the row that was inserted last (row 2). In the example table only row 1 would be removed.
Hoe do I create an SQLite statement that does this for me?
I have tried:
Select statement to find duplicates on certain fields
Delete all Duplicate Rows except for One in MySQL?
https://dba.stackexchange.com/questions/101697/sqlite3-remove-duplicates-by-multiple-columns
Cheers