发布网友
共5个回答
热心网友
问题:表中的数据量大么?大概有多少数据量?
以下SQL已跑通,应满足你的需求
注:b_f 为表名
create table b_f(id int,p1 int,p2 int);
insert into b_f values(1,2,1);
insert into b_f values(2,1,2);
insert into b_f values(3,11,12);
insert into b_f values(4,12,11);
insert into b_f values(5,13,2);
go
初始化数据:
delete b_f where id in删除逆反的p1较的值后的结果:
追问有3000万条数据,这个有妙招吗?
热心网友
delete a from table a,table b where a.p1 = p.p2 and a.p1>b.p2
热心网友
貌似多条数据的话,删除就都删除了,不能够剩余一条吧。
这个感觉还是程序操作比较好吧
热心网友
问题不够详细,id列是否为自增唯一列?如果图中1行和2行互换,应该保留哪一行?
热心网友
这么牛啊 我也想知道 关注一下