語法:DELETE FROM 表名 WHERE id NOT IN ( SELECT temp.min_id FROM ( SELECT MIN(id) min_id FROM 表名 GROUP BY 欄位名 )AS temp ); 備註:id:也是表欄位 實例:DELETE FROM pro_co ...
語法:
DELETE FROM 表名
WHERE id NOT IN (
SELECT temp.min_id FROM (
SELECT MIN(id) min_id FROM 表名
GROUP BY 欄位名
)AS temp
);
備註:id:也是表欄位
實例:
DELETE FROM pro_completed_table
WHERE id NOT IN (
SELECT temp.min_id FROM (
SELECT MIN(id) min_id FROM pro_completed_table
GROUP BY md5
)AS temp
);