-1

I don't know how to delete all duplicate data from table and i don't know know which data is duplicate in my table which query i can run in Mysql please help me

delete from tablename(record) where coluumnname(employer)=ram >0

it working but it's delete all record from table not duplicate

Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
shakti
  • 1
  • 1
  • Check this link http://stackoverflow.com/questions/4685173/delete-all-duplicate-rows-except-for-one-in-mysql – Sanal K Nov 06 '13 at 08:38
  • Since you've already removed all your data - create your table again with unique key and this will not allow you to insert duplicates. – Artur Nov 06 '13 at 08:47

2 Answers2

1

in general..

delete from <table_name> where rowid not in 
                       ( select min(rowid) 
                         from table group by column1..,column2,...column3..);

in your case

delete from table where employer not in 
   (select min(employer) from table group by employer order by 1);
vhadalgi
  • 7,027
  • 6
  • 38
  • 67
0

delete from record where employer='ram' limit 1

Sankar
  • 652
  • 6
  • 13