Link to home
Start Free TrialLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

Mysql sate ment deduct onetable from another table

I have 2 tables table 'product' and  'sale'  how can I write sql statement to deduct sale item from table product
Avatar of honestman31
honestman31

You have to Join the two tables first , so we need to know what is your joint field ,  if you can please post the schema for the two tables and just provide an example for what you want to do exactly  
Avatar of MrTV

ASKER

update product,sale set produt = ( product.ProductQuantity - sale.quantity)


I try like this but it not work
So you have two tables one called products  and it has a field called produt  and another once called  ProductQuantity

and you have another table called sales and it has a filed called produt  and another filed called quantity

is that true ?
ASKER CERTIFIED SOLUTION
Avatar of honestman31
honestman31

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial