I never set up a primary key for the database (I don't know what that is).
The query I mentioned before lists all the rows that are duplicates in the first three of four columns, so I know exactly which rows must be deleted (delete the second duplicate row, I want to keep the first row).
For example I have:
| a | b | c | d |
| a | b | c | x |
I want to delete the second row, because the second row is a duplicate. It does not matter if the fourth field is different.
I could use the query:
insert into newtable select distinct field1,field2,field3,field4 from table;
But in the duplicate rows, since field4 is different, it would copy both rows, when I only need the first row, since it does not matter if field4 is different.
I could use the query:
insert into newtable select distinct field1,field2,field3 from table;
But then it would not copy field4.
So I want to get rid of the second rows where field1, field2, and field3 is the same, and field4 is different.
Is there a way to copy the rows to a new table where only fields 1, 2 and 3 are distinct, and the fourth field can be different?
Thanks so much for any help.