substract acces query

ofekfischer

Honorable
Mar 9, 2012
34
0
10,590
1
hello, i'm doing an access database at school. my project runs a store. i have a table suming up all products arrives, and i have a table showing all sales. i want to show stock with a quety. for that, i need to substarct the number of pieces sold of eack product from the total number of pieces of that product that arrived. how do i do that?
 

Wolfshadw

Splendid
Moderator
Assuming that the product arrives table and the product sales table share a common entity (like a product ID) something similar to the following should work.

select sum(a.productarrives-b.productsales) as currentinventory
from tableproductarrives a, tableproductsales b
inner join on a.productid = b.productid
group by a.productid.

-Wolf sends
 
Thread starter Similar threads Forum Replies Date
T Apps General Discussion 1
L Apps General Discussion 1
S Apps General Discussion 2
A Apps General Discussion 1
C Apps General Discussion 2
P Apps General Discussion 5
A Apps General Discussion 1
Jordan 646 Apps General Discussion 8
R Apps General Discussion 2
AGx-07_162 Apps General Discussion 3
AGx-07_162 Apps General Discussion 9
U Apps General Discussion 1
muppetlol Apps General Discussion 8
chugot9218 Apps General Discussion 2
M Apps General Discussion 1
D Apps General Discussion 3
callumparker666 Apps General Discussion 1
M Apps General Discussion 1
H Apps General Discussion 1
S Apps General Discussion 1

ASK THE COMMUNITY