I’m using this query to list duplicate records
SELECT DISTINCT column1 from table
group by column1 HAVING count(column1) > 1
for my specific query
SELECT DISTINCT ReportingDetailID from reportingdetail group by ReportingDetailID HAVING count(ReportingDetailID) > 1;
works great!
now I need to delete duplicate entries, to end up with nice and clean table
I’m looking at the query here
DELETE FROM table_name
USING table_name, table_name AS vtable
WHERE
(table_name.id > vtable.id)
AND (table_name.req_field=req_field)
According to query author “Replace req_field and table_name – should work without any issues”
I just don’t understand how can I get it to work on my db
my table name is reportingdetail and column name is reportingdetailID
+-------------------+
| ReportingDetailID |
+-------------------+
| 664602311 |
| 664602311 |
| 664602311 |
| 664602311 |
+-------------------+
Delete all duplicates but keep one
Thank you
The basic principle to delete the duplicate rows…
For above I have
myTabsas Table withIdas column whereIdwere duplicated.Please do changes as per your requirement…