Query to count

etk

Registered User.
Local time
Today, 15:54
Joined
May 21, 2011
Messages
52
I have a table FCData with the following fields

FCData
------------
ID ----> auto assigned primary key
Emp_ID
DT
------------

On any given day an employee, represented by Emp_ID, can be recorded multiple times. I want to know if I can query to show how many times per month an employee is recorded. I have a 6 mo time span that I want to show month by month the tallies of employee ids.

I know that I can do this easily in a Pivot table in excel, but I have 500k+ records.
 
Are we to assume that "DT" is a Date type field?
 
Yes, DT is date. It is a general date (including time)
 
Try:
Code:
SELECT FCData.Emp_ID, Count(FCData.Emp_ID) AS CountOfEmp_ID, Month([DT]) AS Mth
FROM FCData
GROUP BY FCData.Emp_ID, Month([DT]);
As the SQL of a query.
 

Users who are viewing this thread

Back
Top Bottom