Count Distinct Number of Email Addresses in the Results of a Query in MS Access -
i have query in ms access return multiple columns multiple tables user-specified period of time. training registration database, , times, people take multiple classes during given time period. need count of distinct number of people trained during given time frame, can't figure out way in access. here query i'm starting with:
select userstable.firstname, userstable.lastname, userstable.emailaddress, userstable.department, userstable.activeuser, classsessionstable.coursename, classsessionstable.starttime, activitytable.registered, activitytable.attended classsessionstable inner join (userstable inner join activitytable on userstable.[userid] = activitytable.[userid]) on classsessionstable.classsessionid = activitytable.classsessionid (((classsessionstable.starttime) between [early date in mm/dd/yyyy hh:mm:ss am/pm format] , [late date in mm/dd/yyyy hh:mm:ss am/pm format]) , ((activitytable.registered)=true)) order userstable.lastname;
from these query results, want count distinct number of email addresses (userstable.emailaddress) returned in query , return number, along rest of query information, in report. using email address because have set requiring unique value in table.
i've seen several suggestions online getting distinct count of something, when try them, either total number of email addresses in userstable, or count of total number of records returned query.
can me count of distinct email addresses returned above query?
i not know of way incorporate in query directly, following query should number of unique email addresses using same conditions , orginal query:
select count(*) numemails (select distinct userstable.emailaddress classsessionstable inner join (userstable inner join activitytable on userstable.[userid] = activitytable.[userid]) on classsessionstable.classsessionid = activitytable.classsessionid (((classsessionstable.starttime) between [early date in mm/dd/yyyy hh:mm:ss am/pm format] , [late date in mm/dd/yyyy hh:mm:ss am/pm format]) , ((activitytable.registered)=true))) mails;
Comments
Post a Comment