Hi, You can't delete selected rows from the same table in mysql. Just create a temp table containing the select result. And delete from table A where existe select ... from temp_table;
Mathias -----Original Message----- From: Jason Pyeron [mailto:[EMAIL PROTECTED] Sent: vendredi 2 septembre 2005 19:53 To: mysql@lists.mysql.com Subject: delete, where, and subselects... to quote the manual: Currently, you cannot delete from a table and select from the same table in a subquery. mysql> select * from paths where id>=(select max(ppathref) from paths); +--------+---------+------------+----------+ | id | typeref | name | ppathref | +--------+---------+------------+----------+ | 216883 | 1 | shared | 216882 | | 216884 | 1 | shared.bs | 216883 | | 216885 | 1 | shared.so | 216883 | | 216886 | 1 | threads.bs | 216882 | | 216887 | 1 | threads.so | 216882 | +--------+---------+------------+----------+ 5 rows in set (0.00 sec) mysql> delete from paths where id>=(select max(ppathref) from paths); ERROR 1093 (HY000): You can't specify target table 'paths' for update in FROM clause Server version: 4.1.14-standard-log Are there any workarounds? Any ideas? TIA -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Partner & Sr. Manager 7 West 24th Street #100 - - +1 (443) 921-0381 Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, purge the message from your system and notify the sender immediately. Any other use of the email by you is prohibited. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]