SELECT * FROM
(SELECT addTime FROM motorcade.car_msg_info GROUP BY addTime HAVING COUNT(addTime) > 1)
AS b)
AND ID NOT IN (SELECT * FROM
(SELECT MIN(ID) FROM motorcade.car_msg_info GROUP BY addTime HAVING COUNT(addTime) > 1)
AS c)
MIN(ID)表示保留ID最小的一条 换成MAX可以保留最新的一条
addTime代表重复数据
时间: 2024-10-13 04:47:35