how to call unique records DISTINCT?COUNT?



I have a Household table and a People table. The Household table has a
record for each address, the people table has a record for each person and an
associated Household ID.

I need to append a field in the Household table based on the number of
people living at that address. I plan to write a separate append queries for
individuals, couples, and "families". So I need select statements that will
return data from my people table where 1)there is only one person in the
household, 2)there are 2 people in the household, and 3) there are 3 or more
people in the household.

How to go about?

Thanks, Amanda



Jeff L

Select HouseholdID, Count(*)
From People
Group by HouseholdID
Having Count(*) = 1

The other 2 would be the same except for the last line, just change
that accordingly, = 2 and >=3.

Hope that helps!

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