我正在尝试加入来自两个完全不同来源的数据。一个来源包含员工的日程安排信息,另一个来源跟踪他们实际工作的内容(例如他们实际吃午饭或休息的时间)。问题是,日程安排程序给出的时间是 BREAK1、BREAK2、BREAK3 和 LUNCH,而跟踪程序只是将它们列为午餐和休息时间。我可以加入数据并很好地享用午餐,但休息时间让我失望。如果我将 BREAK1、BREAK2 和 BREAK3 转换为“Break”,我最终会得到太多的段,因为它会将每个实例与每个其他实例匹配。有没有人可以想到加入这两条信息的方法?谢谢你。
编辑 根据您的要求,这里有一些示例数据:
这是预定时间:
EMP_ID NOM_DATE SEG_CODE START_MOMENT STOP_MOMENT
626009 26-Sep-13 BREAK2 9/26/13 5:00 PM 9/26/13 5:15 PM
625650 26-Sep-13 BREAK2 9/26/13 4:30 PM 9/26/13 4:45 PM
638815 26-Sep-13 BREAK2 9/26/13 4:00 PM 9/26/13 4:15 PM
621649 26-Sep-13 BREAK2 9/26/13 3:30 PM 9/26/13 3:45 PM
567005 26-Sep-13 BREAK2 9/26/13 3:30 PM 9/26/13 3:45 PM
626009 26-Sep-13 LUNCH 9/26/13 2:30 PM 9/26/13 3:30 PM
625650 26-Sep-13 LUNCH 9/26/13 1:30 PM 9/26/13 2:30 PM
638815 26-Sep-13 LUNCH 9/26/13 1:30 PM 9/26/13 2:30 PM
621649 26-Sep-13 LUNCH 9/26/13 12:30 PM 9/26/13 1:30 PM
567005 26-Sep-13 LUNCH 9/26/13 12:30 PM 9/26/13 1:30 PM
626009 26-Sep-13 BREAK1 9/26/13 11:45 AM 9/26/13 12:00 PM
625650 26-Sep-13 BREAK1 9/26/13 11:30 AM 9/26/13 11:45 AM
638815 26-Sep-13 BREAK1 9/26/13 11:45 AM 9/26/13 12:00 PM
621649 26-Sep-13 BREAK1 9/26/13 9:30 AM 9/26/13 9:45 AM
567005 26-Sep-13 BREAK1 9/26/13 9:30 AM 9/26/13 9:45 AM
这是实际时间
EMP_ID Seg_Code Start_Time Stop_Time
625650 Break 9/26/2013 17:54 9/26/2013 17:55
567005 Break 9/26/2013 14:56 9/26/2013 14:59
567005 Break 9/26/2013 15:32 9/26/2013 15:44
638815 Break 9/26/2013 16:34 9/26/2013 16:47
567005 Break 9/26/2013 10:08 9/26/2013 10:21
626009 Break 9/26/2013 17:01 9/26/2013 17:15
625650 Break 9/26/2013 11:31 9/26/2013 11:45
626009 Break 9/26/2013 11:52 9/26/2013 12:07
621649 Break 9/26/2013 9:34 9/26/2013 9:48
621649 Break 9/26/2013 15:31 9/26/2013 15:45
638815 Break 9/26/2013 11:46 9/26/2013 12:02
625650 Break 9/26/2013 16:35 9/26/2013 16:51
567005 Lunch 9/26/2013 12:31 9/26/2013 13:29
625650 Lunch 9/26/2013 13:31 9/26/2013 14:30
626009 Lunch 9/26/2013 14:31 9/26/2013 15:30
638815 Lunch 9/26/2013 13:31 9/26/2013 14:30
621649 Lunch 9/26/2013 12:31 9/26/2013 13:30
我试图了解他们计划的时间和他们实际休息的时间之间的差异(以分钟为单位)。一个正确的例子是:
Badge Seg_Code Scheduled Start Scheduled Stop Actual Start Actual Stop Difference Seg_Duration
192329 Lunch 9/26/13 8:15 AM 9/26/13 9:15 AM 9/26/2013 8:18:27 AM 9/26/2013 9:17:59 AM 3 0:00:59:32
再次感谢你