Union query- count records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello. I have a union query that returns the correct records. I want a
count of how many records are brought back. After moving to a union query
I'm having problems getting a count. I'd appreciate suggestions. Thanks.

SELECT [LastName] & ", " & Nz([NickName],[FirstName]) AS [Member Name],
Contacts.ContactID
FROM Contacts INNER JOIN (Groups INNER JOIN GroupMembers ON Groups.GroupID =
GroupMembers.GroupID) ON Contacts.ContactID = GroupMembers.ContactID
WHERE (((Groups.GroupName)="Board of Directors") AND
((GroupMembers.GMemberEnd) Is Null));
UNION SELECT [LastName] & ", " & Nz([NickName],[FirstName]) AS [Member
Name], Contacts.ContactID
FROM Contacts
WHERE (((Contacts.MemberOption)=1) AND ((Contacts.MemberStatusID) In (1,6))
AND ((Contacts.MemberTypeID) In (1,5)));
 
Beautiful in it's simplicity! Thanks.

KARL DEWEY said:
Use another query to count the results of your Union query.

Stephanie said:
Hello. I have a union query that returns the correct records. I want a
count of how many records are brought back. After moving to a union query
I'm having problems getting a count. I'd appreciate suggestions. Thanks.

SELECT [LastName] & ", " & Nz([NickName],[FirstName]) AS [Member Name],
Contacts.ContactID
FROM Contacts INNER JOIN (Groups INNER JOIN GroupMembers ON Groups.GroupID =
GroupMembers.GroupID) ON Contacts.ContactID = GroupMembers.ContactID
WHERE (((Groups.GroupName)="Board of Directors") AND
((GroupMembers.GMemberEnd) Is Null));
UNION SELECT [LastName] & ", " & Nz([NickName],[FirstName]) AS [Member
Name], Contacts.ContactID
FROM Contacts
WHERE (((Contacts.MemberOption)=1) AND ((Contacts.MemberStatusID) In (1,6))
AND ((Contacts.MemberTypeID) In (1,5)));
 
Back
Top