I need to delete duplicate record from table in mysql. So i have a table name \"employee\" fields are empid, empname, empssn
for getting duplicate record i have writ
Does the trick of wrapping it into a derived table work for this case? (Based on http://www.xaprb.com/blog/2006/06/23/how-to-select-from-an-update-target-in-mysql/)
DELETE FROM employee WHERE (empid, empssn) NOT IN
(
SELECT empid, empssn FROM
(
SELECT MIN(empid) AS empid, empssn FROM employee GROUP BY empssn
) X
);
Edit Yep it seems to work this end.