I have created a temp table (#TempTable) as follow...
DATE HOURS TYPE TIME_BEG TIME_END
Sep 1 2004 12:00AM 5.0 P 12.0 17.0
Sep 6 2004 12:00AM 2.0 W 0.0 0.0
Sep 6 2004 12:00AM 2.0 HP 17.0 19.0
Sep 6 2004 12:00AM 1.0 HP 19.0 20.0
Sep 6 2004 12:00AM 3.0 HP 20.0 23.0
Sep 9 2004 12:00AM 4.0 P 0.0 0.0
Sep 9 2004 12:00AM 11.0 HWO 6.0 17.0
Sep 9 2004 12:00AM 1.0 HWO 17.0 18.0
There are serveral creteria that I want before I could sum up the total hours.
1. Same date
2. Same type
3. Time_End must be equal to the Time_Beg of other record.
For example...
There are 3 records on Sep 6 2004 that matches the above creteria.
Sep 6 2004 12:00AM 2.0 HP 17.0 19.0
Sep 6 2004 12:00AM 1.0 HP 19.0 20.0
Sep 6 2004 12:00AM 3.0 HP 20.0 23.0
Therefore, I would like to group them together as follow...
Sep 6 2004 12:00AM 6.0 HP 17.0 23.0
Here is another example...
There are 2 records on Sep 9 2004 that matches the creteria.
Sep 9 2004 12:00AM 11.0 HWO 6.0 17.0
Sep 9 2004 12:00AM 1.0 HWO 17.0 18.0
Therefore, I would like to group them together as follow...
Sep 9 2004 12:00AM 12.0 HWO 6.0 18.0
I hope I have explained this clearly to all of you.
Thanks in advance!!
DATE HOURS TYPE TIME_BEG TIME_END
Sep 1 2004 12:00AM 5.0 P 12.0 17.0
Sep 6 2004 12:00AM 2.0 W 0.0 0.0
Sep 6 2004 12:00AM 2.0 HP 17.0 19.0
Sep 6 2004 12:00AM 1.0 HP 19.0 20.0
Sep 6 2004 12:00AM 3.0 HP 20.0 23.0
Sep 9 2004 12:00AM 4.0 P 0.0 0.0
Sep 9 2004 12:00AM 11.0 HWO 6.0 17.0
Sep 9 2004 12:00AM 1.0 HWO 17.0 18.0
There are serveral creteria that I want before I could sum up the total hours.
1. Same date
2. Same type
3. Time_End must be equal to the Time_Beg of other record.
For example...
There are 3 records on Sep 6 2004 that matches the above creteria.
Sep 6 2004 12:00AM 2.0 HP 17.0 19.0
Sep 6 2004 12:00AM 1.0 HP 19.0 20.0
Sep 6 2004 12:00AM 3.0 HP 20.0 23.0
Therefore, I would like to group them together as follow...
Sep 6 2004 12:00AM 6.0 HP 17.0 23.0
Here is another example...
There are 2 records on Sep 9 2004 that matches the creteria.
Sep 9 2004 12:00AM 11.0 HWO 6.0 17.0
Sep 9 2004 12:00AM 1.0 HWO 17.0 18.0
Therefore, I would like to group them together as follow...
Sep 9 2004 12:00AM 12.0 HWO 6.0 18.0
I hope I have explained this clearly to all of you.
Thanks in advance!!