Solved

Mysql sate ment deduct onetable from another table

Posted on 2011-03-06
4
518 Views
Last Modified: 2012-05-11
I have 2 tables table 'product' and  'sale'  how can I write sql statement to deduct sale item from table product
0
Comment
Question by:teera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 10

Expert Comment

by:honestman31
ID: 35052532
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
 

Author Comment

by:teera
ID: 35053032
update product,sale set produt = ( product.ProductQuantity - sale.quantity)


I try like this but it not work
0
 
LVL 10

Expert Comment

by:honestman31
ID: 35053277
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
 
LVL 10

Accepted Solution

by:
honestman31 earned 500 total points
ID: 35053332
Also you need to provide the joint  filed ,
 what field represents the relation between the two tables ,
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question