- Local time
- Yesterday, 21:07
- Joined
- Feb 19, 2002
- Messages
- 45,744
Sorry about the period. All sentences end with a period and my fingers just do it
Get rid of the FirstName from the Order by. I forgot the Group By. Make sure the names I chose are correct or change them to match your names. Or, you can fix the outer query that has the union as a subquery so that it includes the last name and assigns a meaningful alias for the count(*) result.
Select qryMembershipUnion.LastName, Count(*) As DupeLastName
From qryMembershipUnion
Group By LastName;
If you want to group by first and last name then add first name to both the select clause and the group by.
Select qryMembershipUnion.LastName, qryMembershipUnion.FirstName, Count(*) As DupeLastName
From qryMembershipUnion
Group By LastName, qryMembershipUnion.FirstName;
When you don't know how to write SQL, your best bet is to stick with the QBE and let Access build it for you. Unfortunately, the QBE gives you no help for Union queries or queries with subqueries.
Get rid of the FirstName from the Order by. I forgot the Group By. Make sure the names I chose are correct or change them to match your names. Or, you can fix the outer query that has the union as a subquery so that it includes the last name and assigns a meaningful alias for the count(*) result.
Select qryMembershipUnion.LastName, Count(*) As DupeLastName
From qryMembershipUnion
Group By LastName;
If you want to group by first and last name then add first name to both the select clause and the group by.
Select qryMembershipUnion.LastName, qryMembershipUnion.FirstName, Count(*) As DupeLastName
From qryMembershipUnion
Group By LastName, qryMembershipUnion.FirstName;
When you don't know how to write SQL, your best bet is to stick with the QBE and let Access build it for you. Unfortunately, the QBE gives you no help for Union queries or queries with subqueries.