Union query- count records

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)));
 
G

Guest

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)));
 

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

Similar Threads

Update query 3
Table short name 4
BUILDING UNION QUERY 9
selecting union query results 7
sql union self-join syntax 27
sql limited by parameter 3
Union Query returning extra rows 1
Yes/No or None 8

Top