• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 526
  • Last Modified:

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
0
teera
Asked:
teera
  • 3
1 Solution
 
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
 
honestman31Commented:
Also you need to provide the joint  filed ,
 what field represents the relation between the two tables ,
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now