I'm trying to find and remove duplicate rows by two columns in a table
one recommended solution is to put a unique index and then remove it, like this:
ALTER IGNORE TABLE your_table ADD UNIQUE (field1,field2,field3);
(Find and remove duplicate rows by two columns)
One of the columns is DATETIME, and i want to use the date part of it as the 'unique' feature to remove duplicates by. How do I do that?
for example:
[column1] [column2]
[2020-01-01 11:11:11] [john]
[2020-01-01 16:11:11] [john]
[2020-07-07 17:17:11] [mike]
i want one of the first 2 rows to be deleted because the date part of the timestamp (in column1) and the name (column2) , are the same.
expected result:
[column1] [column2]
[2020-01-01 11:11:11] [john]
[2020-07-07 17:17:11] [mike]