CREATE TABLE temp2 AS SELECT MAX(id) id FROM sys_oper_procenter GROUP BY pro_title 创建一个temp2的表 根据标题分组,取最大的id 将id存入temp2表中 DELETE FROM sys_oper_procenter WHERE id NOT IN(SELECT id FROM temp2) 在临时表中查出所有id,删除不在临时表里的id
时间: 2024-10-20 21:15:49
CREATE TABLE temp2 AS SELECT MAX(id) id FROM sys_oper_procenter GROUP BY pro_title 创建一个temp2的表 根据标题分组,取最大的id 将id存入temp2表中 DELETE FROM sys_oper_procenter WHERE id NOT IN(SELECT id FROM temp2) 在临时表中查出所有id,删除不在临时表里的id