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!

1 comment:


  1. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
    Hire PHP Mysql Developers in India

    ReplyDelete