今天就跟大家聊聊有关怎么在mysql中删除重复行,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

表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看完上述内容,你们对怎么在mysql中删除重复行有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
网页题目:怎么在mysql中删除重复行-创新互联
URL分享:http://www.xwwzsj.com/article/dhesje.html

售后响应及时
7×24小时客服热线
数据备份
更安全、更高效、更稳定
价格公道精准
项目经理精准报价不弄虚作假
合作无风险
重合同讲信誉,无效全额退款