I ran this in mysql client shell on windows. I don’t understand what the problem is. I know delete from PageInfo where id is correct. I know the subquery is correct. I think in is correct but I don’t use it that often. This entire thing looks correct but i get a problem somewhere. I don’t understand the error message.
How do i delete all the ids the subquery returns?
mysql> delete from PageInfo where id in ( select max(id) from PageInfo where pid
>=2758000 AND pid<2758100 group by pid having count(pid)>1 );
ERROR 1093 (HY000): You can't specify target table 'PageInfo' for update in FROM
clause
In MySQL you cannot modify the same table which is a part of subquery.
more info at http://dev.mysql.com/doc/refman/5.6/en/update.html
Workaround for your problem is described here.