Mysql Database Server

Posted by : Guest
How to delete duplicate rows in sql?
Hi,

My question is: 
How to delete duplicate rows in sql? I want to know the query which will delete duplicate rows reside in my table called User_Info.

Thanks in advance.

-Vivek

 
 
Posted by : Nitin
Re : How to delete duplicate rows in sql?
delete duplicate-rows-in-sql

first create duplicate table like

CREATE TABLE temp SELECT * FROM dept

than write query like this.

DELETE FROM dept WHERE id NOT IN (SELECT MIN(id) FROM temp GROUP BY deptname)

 
 
If you have the better reply, then send it to us. We will display your reply after the approval.
Name : 
Email Id :   
Reply :