View Single Post

   
  #1 (permalink)  
Old 02-29-2008, 01:55 PM
diablo
 
Posts: n/a
Default sql query update

Hi

i need help with formulating a query that will update the a field on one
table depending on the values from another for example

i have a cart table: cartid, buyerid, productid, quantity

i have a product table: productid, quantity

i want to do a:

select * from cart where buyerid=x

and then depending on the returned rows i want to update the product table:

update product set quantity = quantity - cart.quantity where
productid=cart.productid

if you see what i mean?

Any help appreciated

Kal


Reply With Quote