I want to delete all rows which has duplicate entries and I do not want to keep the single one of each. I wish to remove all entries having duplicate entries. Here I referred some code which will keep highest or lowest id value. All queries here will remain a single entry from duplicate records
Mysql
Query I tried is
DELETE * ,count(*)as n FROM cart by rfid HAVING n>1
DB design :
ID(PK)|RFID |CATAGORY
1 |1 |5
2 | 1 | 5
3 | 2 | 4
4 |3 | 6
Output:
ID(PK)|RFID|CATAGORY
2 | 1 | 5
3 | 2 | 4
4 |3 | 6
Expected Result:
ID(PK)|RFID|CATAGORY
3 | 2 | 4
4 |3 | 6