Add and Subtact from different tables

JobWK

New member
Local time
Today, 07:20
Joined
Jan 22, 2010
Messages
7
I have created this query:

SELECT tblCategories.Category, tblThings.ThingsName, tblThings.ThingsCabinet, Nz([ThingsAmtPurchased],0)+Nz([2ndPurchase],0)+Nz([3rdPurchase],0) AS [Total Purchased]
FROM tblCategories LEFT JOIN tblThings ON tblCategories.CategoryID = tblThings.CategoryID;

Now, I need to take information from a different table for the subtraction portion. Adding the other table will not allow me to left join, and I can't figure out how to place the subtraction portion in the code above. The code I believe would be tblPresentor.AmtsGiftsPresented.

There is a relationship between the tables - tblThings and tblPresentor with PresentorID.

Can you help me - still learning.:confused:
 
Last edited:
You really haven't given us enough information for a good answer. Like, what "will not allow me to left join" means. So I'll give you a general answer.

You can create a left join in a query with your main table (I guess that would be tblCategories) and then do an INNER JOIN in this query (the query you included in your post) with the other, newly created query. That might solve your problem.

I'm a little concerned about what I see in your query. It looks like you might be suffering from a non-normalized design. Were your design normalized, I would imagine you could just SUM() your line items and subtract the SUM() of your...whatever it is you're subtracting. If you're subtracting some kind of discount, I would expect that as a line item on your invoice with a negative amount and that would be picked up by the SUM().
 

Users who are viewing this thread

Back
Top Bottom