count of attendance

T

Tia

Hello,
I am trying to create a payroll data entry.
I am trying to know how many attendance days i have by employee, this
sql is not working because it is not calculating total days, it is
giving me one for each atendance
Ex:
Employee Count of att
1Tia Kareem 1
1Tia Kareem 1
1Tia Kareem 1

SELECT [JANUARY 25-12/24-01 ATTENDANCE].ID, [JANUARY 25-12/24-01
ATTENDANCE].Employee, Count([JANUARY 25-12/24-01
ATTENDANCE].UMWORKINGPERDAY) AS CountOfUMWORKINGPERDAY
FROM [JANUARY 25-12/24-01 ATTENDANCE]
GROUP BY [JANUARY 25-12/24-01 ATTENDANCE].ID, [JANUARY 25-12/24-01
ATTENDANCE].Employee, [JANUARY 25-12/24-01 ATTENDANCE].[Date Worked];
 
J

John W. Vinson

Hello,
I am trying to create a payroll data entry.
I am trying to know how many attendance days i have by employee, this
sql is not working because it is not calculating total days, it is
giving me one for each atendance
Ex:
Employee Count of att
1Tia Kareem 1
1Tia Kareem 1
1Tia Kareem 1

SELECT [JANUARY 25-12/24-01 ATTENDANCE].ID, [JANUARY 25-12/24-01
ATTENDANCE].Employee, Count([JANUARY 25-12/24-01
ATTENDANCE].UMWORKINGPERDAY) AS CountOfUMWORKINGPERDAY
FROM [JANUARY 25-12/24-01 ATTENDANCE]
GROUP BY [JANUARY 25-12/24-01 ATTENDANCE].ID, [JANUARY 25-12/24-01
ATTENDANCE].Employee, [JANUARY 25-12/24-01 ATTENDANCE].[Date Worked];

It's giving one record per date worked becauce you are Grouping By Date
Worked. It's giving you exactly what you're asking for...

Remove [JANUARY 25-12/24-01 ATTENDANCE].[Date Worked] from the Group By
clause if you don't want to group by it.

I'd also suggest that you may be using a questionable design. Your table name
[JANUARY 25-12/24-01 ATTENDANCE] suggests that you have multiple tables for
different date ranges, which would be a real mistake. In addition, I've seen
many problems with names containing special characters such as - or /; these
may also be contributing to your problems.
 

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

Similar Threads


Top