Skip to content

Instantly share code, notes, and snippets.

@cloudsben
Created May 7, 2013 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudsben/45da5f99367a0eb987fb to your computer and use it in GitHub Desktop.
Save cloudsben/45da5f99367a0eb987fb to your computer and use it in GitHub Desktop.
多字段删除重复数据,建立多字段唯一索引
create table aaa select min(id) id from biao group by article_id,username;
create index ix_id on aaa(id);
delete from biao where id not in (select id from aaa);
select article_id,username from biao group by article_id,username having(1)>1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment