calculations

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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
 
Back
Top