使用select方式
无法执行
delete from xxx as a,
(
select *,min(id) from xxx group by userId,coint having count(1) > 1
) as b where a.userId = b.userId and a.coint=b.coint and a.id > b.id;
查询可以
select * from xxx as a,
(
select *,min(id) from xxx group by userId,coint having count(1) > 1
) as b where a.userId = b.userId and a.coint=b.coint and a.id > b.id;
使用聚合方式
Select *
FROM xxx d inner
JOIN coinapiset d1 ON d1.userId = d.userId AND d1.coint = d.coint AND d1.id < d.id;
可以删除
Delete d
FROM xxx d inner
JOIN xxx d1 ON d1.userId = d.userId AND d1.coint = d.coint AND d1.id < d.id;
网友评论