Posted by David Portas on 11/16/05 14:46
UPDATE product
SET quantity = quantity -
(SELECT SUM(quantity)
FROM cart
WHERE cart.buyerid = x
AND cart.productid = product.productid)
WHERE EXISTS
(SELECT *
FROM cart
WHERE cart.buyerid = x
AND cart.productid = product.productid) ;
--
David Portas
SQL Server MVP
--
[Back to original message]
|