I only know it for MySQL, you can't delete rows from the same table (this would only work with sub-sub query).

In this Query I take the values from another table.

So this would not work:

delete from dbmail_headervalue b where id in (select id from dbmail_headervalue a where id=1);

but this would work:

delete from dbmail_headervalue c where id in (select id from (select id from dbmail_headervalue a where id=1) b);

the last query force the creation of a temporary table.

Am 02.04.2012, 15:15 Uhr, schrieb Paul J Stevens <p...@nfg.nl>:

On 04/02/2012 02:55 PM, Reindl Harald wrote:
delete from dbmail_headervalue where id not in (select headervalue_id from dbmail_header);


correct me if I'm wrong but last I checked neither MySQL nor PostgreSQL
support deleting rows selected in a sub-query.


_______________________________________________
DBmail mailing list
DBmail@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to