Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a TOP query

Status
Not open for further replies.

jasonphillipstx

Technical User
Dec 10, 2001
43
0
0
US
I have 2 tables

FAMILIES
FamilyID, Mom, Dad

CHILDREN
FamilyID, FirstName, Birthday

I have a query on the children table that selects children under age 11
qry_Kids_Under_11 returns the following columns
FamilyID, FirstName, Birthday

I want to list the families that have kids under age 11 so I can send them a postcard, but many have several kids under 11 and I do not want to send multiple cards to each family.

I hve tried several methods but get incorrect results. thanks in advance.
 
Have a look at the DISTINCT predicate:
SELECT DISTINCT F.FamilyID, F.Mom, F.Dad
FROM FAMILIES AS F INNER JOIN qry_Kids_Under_11 AS K ON F.FamilyID = K.FamilyID

Another way is an aggregate query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top