共計(jì) 491 個(gè)字符,預(yù)計(jì)需要花費(fèi) 2 分鐘才能閱讀完成。
自動(dòng)寫(xiě)代碼機(jī)器人,免費(fèi)開(kāi)通
今天就跟大家聊聊有關(guān)怎么在 mysql 中刪除重復(fù)行,可能很多人都不太了解,為了讓大家更加了解,丸趣 TV 小編給大家總結(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ù)
iduserIdfanId111211311422522633733
去重
delete t from relation s
join relation t using(userId,fanId)
where s.id t.id;
看完上述內(nèi)容,你們對(duì)怎么在 mysql 中刪除重復(fù)行有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注丸趣 TV 行業(yè)資訊頻道,感謝大家的支持。
向 AI 問(wèn)一下細(xì)節(jié)
正文完