mysql删除重复数据

查出重复数据放入tmp零时表中:

create table tmp as select  min(id) as id  from restaurant_info  group  by  restaurant_name   having  count(restaurant_name) > 1;

根据零食表中id删除表中重复数据:

delete from restaurant_info where id in(select id from tmp );

删除零食表:

drop table tmp;

完毕。

你可能感兴趣的:(mysql)