Id | |
---|---|
1 | |
2 | bob@example.com |
1 Create table If Not Exists Person (Id int, email varchar(255)); 2 3 insert into Person (Id, email) values (1, 'john@example.com'); 4 insert into Person (Id, email) values (2, 'bob@example.com'); 5 insert into Person (Id, email) values (3, 'john@example.com');
最终SQL:
1 DELETE 2 p1 3 FROM 4 Person p1, 5 Person p2 6 WHERE 7 p1.Email = p2.Email AND p1.Id > p2.Id;