View Single Post
  #8  
Old May 17th, 2010, 04:14 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default SELECT DISTINCT query

SELECT DISTINCT tblFamily.FamLastName,
tblAddress.Street,
tblAddress.City,
tblAddress.State,
tblAddress.ZipCode
FROM tblGroup INNER JOIN (((tblFamily INNER JOIN tblIndividual ON
tblFamily.FamID = tblIndividual.InFamID) INNER JOIN tblAddress ON
tblFamily.FamID = tblAddress.AdFamID) INNER JOIN tblGroupMembers ON
tblIndividual.IndID = tblGroupMembers.GMIndID) ON tblGroup.GroupID =
tblGroupMembers.GMGroupID
WHERE (((tblGroup.GroupName) Like "*flm*"));

--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Kathy R." wrote:

Jerry Whittle wrote:
Are you saying that you only want one record for the tblFamily.FamID? If so
is that field the primary key field in tblFamily? Also what do you want to
see for the reset of the record? For example which individual do you want to
see?


Hi Jerry,

Yes, the tblFamily.FamID is the primary key. Essentially, what I want
is to address labels to the "x" family if they have one, or more, family
members in FLM.

So, if Joe Miller, Sue Miller and Bob Jones are all in FLM, I would like
to see (distinct on FamID, not on last name!):
Miller
Jones

From which I would build the string:
The Miller Family
123 Main Street
Anytown, NY 55555

The Jones Family
456 Elm Avenue
Anytown, NY 55555

But I need the individual's information in there because the individual
is the one that is a member of a group. The family is not a member of
the group.

The tblFamily is in a one-to-many relationship with both the tblAddress
and tblIndividual. The tblIndividual is in a many-to-many relationship
with tblGroup with the joining table tblGroupMembers.

I hope that's a bit clearer. If I've made the waters more muddy let me
know and I'll try to explain better.

Kathy R.
.