Creating a query counting a group and subgroups

K

khenry

Hello

I have a query that I've created counting households with a certain criteria
(head start program). Based on the results, I would also like to
display/count households that have the head start program and other programs.
I'm half there, with the head start count. How do I set the criteria to
only look at those households and tell me the other programs count?
 
M

Mike

Hi There,

It might be easier to break this into a number of queries.
e.g.

if your table contains: house_id, program_id

your first query could be called head_program_query:
Select house_id, programs
from house_programs_table
where program_id = head_program_id

then you can select data based on this query:
Select count(house_id)
from head_program_query

or

Select count(house_id)
from head_program_query
where program_id = other_program

and so on.
hope this helps,
mike.
 
Top