I have a query that sums the daily hours for each employee based upon 2 categories (Normal and Leave). Since most of these employees are salary-exempt, I need to report 7 hours total for each date unless they took leave time, which if they did I need to report how many total hours of leave time and how many normal hours.
What I have right now:
AdvocateLNFN act_date category hours
Doe, John 7/1/2006 Normal 8.2
Doe, John 7/2/2006 Normal 5.8
Doe, John 7/3/2006 Normal 3.5
Doe, John 7/3/2006 Leave 3.5
Doe, John 7/4/2006 Leave 7.0
Doe, John 7/5/2006 Normal 4.3
What I need:
AdvocateLNFN act_date category hours
Doe, John 7/1/2006 Normal 7.0
Doe, John 7/2/2006 Normal 7.0
Doe, John 7/3/2006 Normal 3.5
Doe, John 7/3/2006 Leave 3.5
Doe, John 7/4/2006 Leave 7.0
Doe, John 7/5/2006 Normal 7.0
I know how to write an expression to change any "Normal" hours to 7.0, but I don't know what I need to do to get the query to recognize when there are 2 entries for the same date.
Any suggestions would be most welcome.
Here is my SQL statement (this query is built off a main query that sums the hours for the day):
SELECT [trw Timeslip - EZ Labor].AdvocateLNFN, [trw Timeslip - EZ Labor].act_date, [trw Timeslip - EZ Labor].category, IIf([category]="Normal","7.0",[sumofhours]) AS [Total Hours]
FROM [trw Timeslip - EZ Labor]
GROUP BY [trw Timeslip - EZ Labor].AdvocateLNFN, [trw Timeslip - EZ Labor].act_date, [trw Timeslip - EZ Labor].category, IIf([category]="Normal","7.0",[sumofhours])
ORDER BY [trw Timeslip - EZ Labor].AdvocateLNFN, [trw Timeslip - EZ Labor].act_date;
What I have right now:
AdvocateLNFN act_date category hours
Doe, John 7/1/2006 Normal 8.2
Doe, John 7/2/2006 Normal 5.8
Doe, John 7/3/2006 Normal 3.5
Doe, John 7/3/2006 Leave 3.5
Doe, John 7/4/2006 Leave 7.0
Doe, John 7/5/2006 Normal 4.3
What I need:
AdvocateLNFN act_date category hours
Doe, John 7/1/2006 Normal 7.0
Doe, John 7/2/2006 Normal 7.0
Doe, John 7/3/2006 Normal 3.5
Doe, John 7/3/2006 Leave 3.5
Doe, John 7/4/2006 Leave 7.0
Doe, John 7/5/2006 Normal 7.0
I know how to write an expression to change any "Normal" hours to 7.0, but I don't know what I need to do to get the query to recognize when there are 2 entries for the same date.
Any suggestions would be most welcome.
Here is my SQL statement (this query is built off a main query that sums the hours for the day):
SELECT [trw Timeslip - EZ Labor].AdvocateLNFN, [trw Timeslip - EZ Labor].act_date, [trw Timeslip - EZ Labor].category, IIf([category]="Normal","7.0",[sumofhours]) AS [Total Hours]
FROM [trw Timeslip - EZ Labor]
GROUP BY [trw Timeslip - EZ Labor].AdvocateLNFN, [trw Timeslip - EZ Labor].act_date, [trw Timeslip - EZ Labor].category, IIf([category]="Normal","7.0",[sumofhours])
ORDER BY [trw Timeslip - EZ Labor].AdvocateLNFN, [trw Timeslip - EZ Labor].act_date;