靖西网(无图版) -> 电脑 ->正文 登录 -> 注册 ->

mysql除重复记录实用代码,只保留一条

牛牛动态域名 2015-08-21 23:23
create table tmp001 as select min(jid) as col1 from xiweb_xxx group by tname;
delete from xiweb_xxx where jid not in (select col1 from tmp001);
drop table tmp001;

min()为保留最小jid的记录


查看完整版本:
[-- mysql除重复记录实用代码,只保留一条 --]
回复主题 -> 发表主题


jingxi.net @ 2014