calculations

G

Guest

I have a table with the following logical structure:

Name Number of apples Number of oranges Total fruits

Mike 3 2
5
John 4 5
9
Nick 2 6
8
Peter 3 5
8

How can I calculate how many apples (or oranges, or fruits in total) were
eaten by Mike and John together (i. e. to get sum total only for them) , but
ignore Nick and Peter? Or how can I exclude Peter from these calculations?

Your help is very much appreciated!
 
M

Michel Walsh

Are you sure this is not homework?


SELECT SUM(apples)+SUM(oranges)
FROM myTable
WHERE Name NOT IN("Nick", "Peter")


That works since the WHERE clause is performed BEFORE the Aggregation/Group.


Vanderghast, Access MVP
 

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