SUM of fieldname holler when fieldname area has the same value

Sniperbooya

Registered User.
Local time
Today, 10:57
Joined
Jan 30, 2015
Messages
16
Hi there,

I have got a query which gives me the following output;

Nr ----------- area ------- area 2 ---------- holler
14-1096-------1------------1-----------------5.9
14-1097-------2------------2-----------------7.8
14-1100-------1------------1-----------------13.4
14-1101-------2------------2-----------------7.8

What i would like to do is to calculate the sum of holler when they are in the same area.

So the sum of nr 14-1096 + 14-1100 and 14-1097 + 14-1101.

Ive tried to do the following;

I tried to do the following just to check it would even work;

Code:
test: (SELECT Sum([holler]) FROM querytoetsn2hr_gemiddelde_filter WHERE ((querytoetsn2hr_gemiddelde_filter.area)=("1")))

Which worked perfectly, it gave me 19.3..

Code:
test: (SELECT Sum([holler]) FROM querytoetsn2hr_gemiddelde_filter WHERE ((querytoetsn2hr_gemiddelde_filter.area)=(querytoetsn2hr_gemiddelde_filter.area2)))

That gave me the sum of all 4 the Nrs. Which makes sense, because you basically say that as long as area and area are the same calculate the sum of holler.

I have no idea if there is a way to say "sum of holler when area has the same value".

Any ideas?
 
I can't quite grasp your question but I suspect you are looking for this addition to the query.

GROUP BY Area

This will give you sums for each unique Area where they match.
 
How about making an additional query?
Code:
Select area ,[area 2], sum( holler)
from querytoetsn2hr_gemiddelde_filter
Group by Area, [Area 2]

and if need be join this back to your current table or query

Regards from Amsterdam
 

Users who are viewing this thread

Back
Top Bottom