--不知道为啥这个mysql外边还要包一层,不然就报错
DELETE
FROM course WHERE name IN ( select mm.name from ( SELECT a.name as name FROM course a GROUP BY a. NAME HAVING count(a.NAME) > 1)mm ) AND id NOT IN ( select nn.id from ( SELECT min(id) as id FROM course a GROUP BY a. NAME HAVING count(a.NAME) > 1)nn );