Friday, 29 July 2011

How to delete duplicate record in mysql?

Hi Folks,

Suppose we have a table name employee consisting two fields:

Table Name: employee
id  name
1   ashwani
2   varun
3   rajesh
4   varun
5   amit
6  ashwani


CREATE TABLE new_employee as SELECT * FROM employee WHERE 1 GROUP BY name;

DROP TABLE employee;

RENAME TABLE new_employee TO employee;


Cheers!

No comments:

Post a Comment