Sum of 2 lines of Count query

M

Mary

Hello Access community,
I am a novice and want the sum of a query that results in
CountID Type
10 1
2 2

I would like to know how to get the sum of 12, preferably as a new field
within that same query, or else in a new query. Thank you in advance.
Mary
 
D

Darren

Just wrap you query in another query

Select Sum([Countid]) as SumOfCountID
From (Select Count([someField]) as CountID from [sometable])
 
K

Klatuu

You will need another query that uses this query as its recordsource. It
should have only one field, CountID, and be a Totals query using Sum in the
Group by.
 
K

Klatuu

Sorry, Mary, I really don't know if you can. It might be possible with a
CrossTab query, but I skipped class that day and it is a weak point for me.
 
J

John Vinson

Hello Access community,
I am a novice and want the sum of a query that results in
CountID Type
10 1
2 2

I would like to know how to get the sum of 12, preferably as a new field
within that same query, or else in a new query. Thank you in advance.
Mary

Not at all easily. A hairy UNION query might do it.

However, if you just want to *see* these subtotals, consider using a
Form (for onscreen use) or Report (for printing). Base it on this
query and put a textbox on the Form (or Report) footer with a control
source

=Sum([CountID])

John W. Vinson[MVP]
 
Top