mysql中删除重复记录,只保留一条
DELETE FROM stock_market WHERE date='2021-03-19' AND code IN (SELECT code FROM (SELECT code FROM stock_market where date='2021-03-19' GROUP BY code HAVING COUNT(code)>1) e)
AND id NOT IN (SELECT id FROM (SELECT MIN(id) AS id FROM stock_market where date='2021-03-19' GROUP BY code HAVING COUNT(code)>1) t)