substract acces query

ofekfischer

Honorable
Mar 9, 2012
34
0
10,590
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?
 
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