新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
怎么在mysql中刪除重復(fù)行-創(chuàng)新互聯(lián)
今天就跟大家聊聊有關(guān)怎么在mysql中刪除重復(fù)行,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
表relation
create table relation( id int primary key auto_increment, userId int not null, fanId int not null );
插入幾條數(shù)據(jù)
insert into relation(userId,fanId) values(1,1) ,(1,1) ,(1,1), (2,2),(2,2) ,(3,3),(3,3);
表中的數(shù)據(jù)
id | userId | fanId |
---|---|---|
1 | 1 | 1 |
2 | 1 | 1 |
3 | 1 | 1 |
4 | 2 | 2 |
5 | 2 | 2 |
6 | 3 | 3 |
7 | 3 | 3 |
去重
delete t from relation s join relation t using(userId,fanId) where s.id看完上述內(nèi)容,你們對(duì)怎么在mysql中刪除重復(fù)行有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。
分享文章:怎么在mysql中刪除重復(fù)行-創(chuàng)新互聯(lián)
文章網(wǎng)址:http://fisionsoft.com.cn/article/dhesje.html