delete from table1 where id in (
SELECT * FROM (
select max(id) id from table1 group by date HAVING COUNT(*) >1
) AS p
)
reference: https://stackoverflow.com/questions/4562787/how-to-delete-from-select-in-mysql
[mysql] delete 使用 in 的條件 寫法
分類:mysql