Re: Unique monthly count
- From: "John Spencer" <spencer@xxxxxxxxx>
- Date: Wed, 31 May 2006 15:19:51 -0400
Unless I am wrong, the two should give you different results if an employee
works multiple times in the month.
I was attempting to give you a count of the number of employees that worked
in the month - whether they had one workdate record or multiple workdate
records in the month. I believe Karl Dewey's would count the number of
workdate records in the month.
"EdS" <EdS@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:33569025-D4A3-406E-ACD2-0945DA2666D7@xxxxxxxxxxxxxxxx
Appreciate your reply.. Your suggestion and Karl Dewey's both work!
--
Thanks. EdS
"John Spencer" wrote:
Perhaps something like the following UNTESTED SQL statement.
SELECT WorkMonth, Count(Employee) as EmployeeCount
FROM
(SELECT Format(WorkDate, "yyyy-mm") AS WorkMonth, Employee
FROM [Job_Time]
WHERE WorkDate Between DateSerial(Year(Date())-3,Month(Date()),1)
And DateSerial(Year(date()), Month(Date()),0)
GROUP BY Format(WorkDate, "yyyy-mm"), Employee) as UniqueTable
GROUP BY WorkMonth
"KARL DEWEY" <KARLDEWEY@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5AB4281D-963A-4A47-B373-26F867E63ABA@xxxxxxxxxxxxxxxx
UNTESTED --
SELECT Format([WorkDate], "mmm yyyy") AS [Work Month],
Count([Employee])
AS
[# of Employees]
FROM [Job_Time]
WHERE Year([WorkDate]) >= Year(Date()-3
ORDER BY Format([WorkDate], "yyyymm");
"EdS" wrote:
Hello.. I have a table that keeps the jobs worked on daily by
employees,
meaning the employee id may appear more than once each day. I have
created
the following code in a query to give me the unique count of employees
who
worked during the month:
SELECT Count([Employee]) AS [# of Employees] FROM (SELECT DISTINCT
[Employee] FROM [Job_Time] WHERE Year([WorkDate]) = Year(Date()) AND
Month([WorkDate]) = Month(Date()))
This works fine for the current month, however, I need to produce a
month
by
month count for the past three years. Any suggestions?
--
Thanks. EdS
.
- Follow-Ups:
- Re: Unique monthly count
- From: EdS
- Re: Unique monthly count
- References:
- Re: Unique monthly count
- From: John Spencer
- Re: Unique monthly count
- Prev by Date: Multiselect listbox parameter query followup
- Next by Date: Re: Unique monthly count
- Previous by thread: Re: Unique monthly count
- Next by thread: Re: Unique monthly count
- Index(es):
Relevant Pages
|
|