mysql多字段组合删除重复行
程序员文章站
2023-08-22 17:02:24
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
)