欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

mysql多字段组合删除重复行

程序员文章站 2022-05-25 20:49:09
DELETEFROM boll_paramWHERE id in ( SELECT a.id FROM ( SELECT id FROM boll_param WHERE (symbol, time_frame, ma, k, std, N, 回测起始日期, 回测结束日期, 交易方向) IN ( S ......
delete
from boll_param
where id in (
select a.id
from (
select id
from boll_param
where (symbol, time_frame, ma, k, std, n, 回测起始日期, 回测结束日期, 交易方向) in (
select symbol,
time_frame,
ma,
k,
std,
n,
回测起始日期,
回测结束日期,
交易方向
from boll_param
group by symbol, time_frame, ma, k, std, n, 回测起始日期, 回测结束日期, 交易方向
having count(*) > 1
)
and id not in (
select minid
from (
select min(id) as minid
from boll_param
group by symbol, time_frame, ma, k, std, n, 回测起始日期, 回测结束日期, 交易方向
having count(*) > 1
) dt
)) a
)