-
-
Save cloudsben/45da5f99367a0eb987fb to your computer and use it in GitHub Desktop.
多字段删除重复数据,建立多字段唯一索引
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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