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
)