1、
不能先select出同一表中的某些值,再update这个表(在同一语句中)
DELETE FROM Person WHERE id NOT IN
( SELECT MIN(id) as id
FROM Person GROUP BY email )
所以要通过子表(派生表)
DELETE FROM Person WHERE id NOT IN
( select *from (SELECT MIN(id) as id
FROM Person GROUP BY email ) as a )
**ps:**每个派生表必须有自己的别名,所以给查出的子表一个别名
2、
如果在delete时使用了别名,就要在delete与from中加入别名
delete p1 from person p1,perosn p2
where p1.id = p2.id;