Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Server Report

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-07-06 : 07:50:05
alice writes "I have Employee table.
Employee table
--------------
EmpNO| DayOfWork | HoursWorked | Holiday Code
1 | 07/04/2005| 0 | GovernmentHoilday(GH)
2 | 07/04/2005| 0 | GovernmentHoilday(GH)
3 | 07/04/2005| 0 | GovernmentHoilday(GH)
1 | 07/05/2005| 8 | Null
2 | 07/05/2005| 8 | Null
3 | 07/05/2005| 8 | Null
1 | 07/06/2005| 8 | Null
2 | 07/06/2005| 8 | Null
3 | 07/06/2005| 0 | Sick(S)
......
.....
3 | 07/30/2005| 8 | Null
--------------------------------------------------------

Report from 07/04/2005 to 07/30/2005
-----------------------------------
EmpNO| EmpName| HoursWorked| HolidayCOde
1| A | 152hrs| GH
2| B | 152hrs| GH
3| C | 148hrs| Sick(S)
---------------------------------------------------------
The Employee details for each Employee will be entered into table every day.This is a program in ASP.net which retrives data from SQL Server database into excelsheets.So when an user enters the 1st date staring on monday and 2nd date ending on sunday.This dates will be used for report generation of emplyees.It generates the total number of hours worked for that range of dates entered.If we consider from july 4th(monday) to july 30th(Sunday)we will have 20 entries for each employee in the Employee database.So my aim is to count all the holliday codes for each employee and give the output in report.I am able to count Total number of hours including leaves.
I want the output like the below
--------------------------------------------------------------
Report from 07/04/2005 to 07/30/2005
-----------------------------------
EmpNO| EmpName| HoursWorked| HolidayCOde
1| A| 152hrs| GH=8HR
2| B| 152hrs| GH=8hrs
3| C| 140hrs| GH=8HR,S=16HR.


I am not able to count the holiday code as mentioned above."
   

- Advertisement -