我有两张桌子
活动
EventCode EventDate
1 2013-07-22 04:00:00.000
2 2013-07-21 11:00:00.000
3 2013-07-21 10:00:00.000
DeviceSignal是事务表
TimeStamp DeviceID Value
2013-07-22 03:10:00.000 Dev1 33
2013-07-22 03:00:00.000 Dev2 22
2013-07-21 11:00:00.000 Dev3 23
2013-07-21 10:50:00.000 Dev4 45
2013-07-21 10:40:00.000 Dev5 23
2013-07-21 10:30:00.000 Dev1 54
2013-07-21 10:20:00.000 Dev2 22
2013-07-21 09:50:00.000 Dev1 11
2013-07-21 09:40:00.000 Dev2 23
基于 EventDate,我想获取时间戳、设备 ID 和值,TimeStamp 在 EventDate Hierarchy 中,我怎样才能得到低于输出?
EventCode EventDate TimeStamp DeviceID Value
1 2013-07-22 04:00:00.000 2013-07-22 03:10:00.000 Dev1 33
1 2013-07-22 04:00:00.000 2013-07-22 03:00:00.000 Dev2 22
2 2013-07-21 11:00:00.000 2013-07-21 10:50:00.000 Dev4 45
2 2013-07-21 11:00:00.000 2013-07-21 10:40:00.000 Dev5 23
2 2013-07-21 11:00:00.000 2013-07-21 10:30:00.000 Dev1 54
2 2013-07-21 11:00:00.000 2013-07-21 10:20:00.000 Dev2 22
3 2013-07-21 10:00:00.000 2013-07-21 09:50:00.000 Dev1 11
3 2013-07-21 10:00:00.000 2013-07-21 09:40:00.000 Dev2 23