Need total amount of items purchsed for all the persons

C

CAPTGNVR

Dear All

Have two tables. tab1 with 50 names and their id; tab2 with 100 items,
price, stock.

Need to make a list where few people from tab1 purchased items in tab2
showing only the names and total cost of all the 100 items purchased or say
if a particular person purchased only 10 of items.

Pls guide me.

brgds/captgnvr
 
K

KARL DEWEY

if a particular person purchased only 10 of items.
This could mean not list those purchasing 9 or less and 11 or more.
Try this --
SELECT Names, Sum([Purchase]*[Price]) AS Total_Purchase
FROM tab1 INNER JOIN tab2 ON tab1.ID = tab2.ID
GROUP BY Names
HAVING Sum([Purchase]*[Price]) >= 100 AND Count([stock]) >= 10;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top