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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -