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
teeraAsked:
Who is Participating?
 
honestman31Connect With a Mentor Commented:
Also you need to provide the joint  filed ,
 what field represents the relation between the two tables ,
0
 
honestman31Commented:
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  
0
 
teeraAuthor Commented:
update product,sale set produt = ( product.ProductQuantity - sale.quantity)


I try like this but it not work
0
 
honestman31Commented:
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 ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.