On 10/03/2013 09:28 AM, Harald Leithner wrote:

> for mysql (any maybe other db engines) you could use:
> 
> DELETE FROM table where id in (SELECT id FROM (SELECT id FROM table) AS
> tmptable);

Doing a quick look at the postgresql and sqlite sites I think they both
support automatic temporary tables as SELECT .. AS .., so this might work.

> 
> stacking 2 select tables forces mysql to use a temp table, thie could
> also have limit clause
> 
> Alternative I would do it in dbmail by giving a list of ids using WHERE
> id in (1,2,3).

That approach is already used quite extensively in dbmail. Just not in
the maintenance code :-(



-- 
________________________________________________________________
Paul J Stevens        pjstevns @ gmail, twitter, skype, linkedin

  * Premium Hosting Services and Web Application Consultancy *

           www.nfg.nl/[email protected]/+31.85.877.99.97
________________________________________________________________
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to