我的表格有类似下面的信息
Emp Date START_TIME END_TIME Code Minutes
--- -------- ------------------- ------------------- ---- -------
E1 11/1/2012 11/1/2012 6:55:00 AM 11/1/2012 7:01:00 AM C1 6
E1 11/1/2012 11/1/2012 6:57:00 AM 11/1/2012 8:01:00 AM C2 64
E2 11/1/2012 11/1/2012 6:57:00 AM 11/1/2012 8:00:00 AM C2 63
E1 11/2/2012 11/2/2012 7:35:00 AM 11/2/2012 8:01:00 AM C1 26
预期输出
Date Code Range Minutes
--------- ---- ----------------------- -------
11/1/2012 C1 6:00:00 AM-7:00:00 AM 60
11/1/2012 C1 7:00:00 AM-8:00:00 AM 60
11/1/2012 C2 6:30:00 AM-7:00:00 AM 30
11/1/2012 C2 7:00:00 AM-7:30:00 AM 60
11/1/2012 C2 7:30:00 AM-8:00:00 AM 60
11/1/2012 C2 8:00:00 AM-8:30:00 AM 30
11/2/2012 C1 7:30:00 AM-8:00:00 AM 25
11/2/2012 C1 8:00:00 AM-8:30:00 AM 1
我希望按日期分组,并且代码的总时间分别为60分钟。我的限制是使用select语句实现这一点