Count uniques with other fields in the query

G

Guest

Hello,
I have been trying everything. What I want to do is run a query on one
table that counts the unique occurances of Emp #. also, I want to group by
month, week, or day. I pasted in some code that I found...however it is not
working. Please help with some basic code that will allow me to count unique
occurances of a field.

Examples:
Total - 45 unique Emp #
Mar - 15 unique Emp #
Apr - 19 unique Emp #
Week 1 - 22 unique Emp #

Thanks for the help!
 
D

Darren

Use a subquery...

ex:

Select Count(Empno), mo, Empno from
(
Select Distinct EmpNo, Month([SomeDateField]) as Mo
Where ....
)
Group By Mo, empno
 

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

Top