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.
| Author |
Topic |
|
masteripper
Starting Member
25 Posts |
Posted - 2009-06-18 : 01:48:21
|
| Hi to everybody.I has this problem with a report i need and i would really like some help.I have a table with the workers leaves.The table is like thisEmployeeID LeaveStartDate LeaveEndDateWhat is i need is some what a dynamic calendar of absenceLets say WorkerA gets a leave at 20/06/2009 which ends at 22/06/2009WorkerB gets a leave at 18/06/2009 which ends at 21/06/2009The calendar/Report would go something like this22/06/2009--------------------------WorkerA Absent................................21/06/2009--------------------------WorkerA AbsentWorkerB Absent.................................20/06/2009------------------------WorkerA AbsentWorkerB Absent..................................19/06/2009-------------------------WorkerB Absent...............................18/06/2009-------------------------WorkerB Absent................................Well can this being done with a single query or i have programmaticaly add the Pseudo RecordsI need an output from the query like thisEmployeID DateAbsentThanks in advance |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
|
|
masteripper
Starting Member
25 Posts |
Posted - 2009-06-18 : 03:28:53
|
| It seems like a lot of reading....Well maybe i should go the programming way.Retrieve the data and manipulate them in order to get the output i need.Thanks anyway. |
 |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
Posted - 2009-06-18 : 03:36:40
|
| Well its not that much of reading.Put it in a simple way - Create a Calendar Table, Left Join it with workers leaves table. So you will get all the dates.And this approch will give you faster result, compare to craeting missing dates by programmingMangal Pardeshihttp://mangalpardeshi.blogspot.com |
 |
|
|
masteripper
Starting Member
25 Posts |
Posted - 2009-06-18 : 07:26:28
|
| Well to let you know i just made it .... by programmingThanks for your interest. |
 |
|
|
|
|
|