0

I want to delete duplicate rows from this MySQL table without creating a temp table. I tried to do it "WITH CTE" but that doesn't work as I am using MySQL-Workbench.

Please click here to view the table:

I tried to achieve the result using this query but it's not working.

DELETE FROM employee WHERE 
(SELECT * FROM
   (SELECT row_number() OVER (partition by id) rn FROM employee) 
 alias) > 1;

I want to delete all duplicate rows but keep one.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181

0 Answers0