[AccessD] Access 2k - Report group counter

Ken Ismert KIsmert at TexasSystems.com
Wed Apr 19 13:02:01 CDT 2006


 
Patricia, 

> I have a report where I want to count the number of unique People in a
group that received checks ...  

Well, in SQL Server you have Count(Distinct PEOPLE_ID), which will count
the distict people receiving checks. 

Access has no Count Distict function. To duplicate the function, you
have to make a separate query:

    SELECT qSub.GroupID, Count(qSub.PEOPLE_ID) AS GrpPeopleCt 
    FROM (SELECT DISTINCT GroupID, PEOPLE_ID FROM tblMyTable) AS qSub 
    GROUP BY GroupID

This query simply counts the distict people returned from its subquery,
qSub.

Add this query to your original, and join by your GroupID field to get
your GrpPeopleCt value for each group. 

-Ken



More information about the AccessD mailing list