表relation
create table relation( id int primary key auto_increment, userId int not null, fanId int not null );
插入几条数据
insert into relation(userId,fanId) values(1,1) ,(1,1) ,(1,1), (2,2),(2,2) ,(3,3),(3,3);
表中的数据
| 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<t.id;
总结
以上所述是小编给大家介绍的mysql删除重复行的实现方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
继续阅读与本文标签相同的文章
上一篇 :
Julia发布全功能调试器:4大新功能问世
下一篇 :
C语言实现linux网卡检测精简版
-
丘成桐:我国应重视基础科学和数学的发展
2026-05-15栏目: 教程
-
Win10系统竟自带了表情包?你知道在哪吗?
2026-05-15栏目: 教程
-
中国芯片研究再获国际顶会最佳论文提名!清华魏少军、刘雷波团队出品
2026-05-15栏目: 教程
-
全网“传奇手游”相关搜索排名TOP100 全网“传奇手游”相关搜索排行榜
2026-05-15栏目: 教程
-
又一国产巨头崛起!19天狂建1367个5G基站,日韩始料不及
2026-05-15栏目: 教程
