> DELETE from cart 
> WHERE product_id NOT IN( SELECT id FROM products where status = 'enabled')
> AND user_id = '90'
> 
> The above is what I would like it to do, though I can not test it as I do
> not have access to a mysql that supports it.
> 
> Aside from two queries, can someone perhaps show me how to run the same as
> above but without the sub query?

I am pretty sure I worked this out with the following:

DELETE cart2.*
FROM cart2 c
LEFT JOIN products p
ON c.product_id = p.id
WHERE c.user_id = '90' AND p.id IS NULL
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to