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 2008 Forums
 Transact-SQL (2008)
 Multiple DayParts in one shift

Author  Topic 

JAdauto
Posting Yak Master

160 Posts

Posted - 2015-04-27 : 16:53:47
I need to split out the number of minutes worked for one shift, that could possibly span multiple day parts.

Example: employee 1 clocks in at 9:15am and clocks out at 17:09. That is a total of 474 minutes worked.


The day parts are as follows along with the allocation of how many minutes of his total shift were worked in each period:
Name start end Total minutes per shift
Breakfast 4:00 10:30 75
Lunch 10:30 14:00 210
Snack 14:00 17:00 180
Dinner 17:00 20:00 9
PM Snack 20:00 22:00 0
Late Night 22:00 4:00 0
474


I can get the day part breakout and I can get the shift information. I just cannot figure out how to join them to get the allocation between the possible multiple shifts.

Thoughts or suggestions are appreciated.

Thanks,
JAdauto

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2015-04-28 : 16:56:20
What are you expecting as output? Minutes per shift? Total minutes? Both?



I would rather be the man who bought the Brooklyn Bridge than the one who sold it. -Will Rogers
Go to Top of Page
   

- Advertisement -