Hi,this is my sample of simple sql code.create table work_time( date datetime,working_time_second int,person varchar(10))insert into work_timeselect '2004-06-24 06:19:40.000',3525,'John1' union allselect '2004-06-24 08:03:30.000',13525,'John1' union allselect '2004-06-24 08:03:30.000',1234,'Jim1' union allselect '2004-06-24 10:03:30.000',19284,'Jim1' union allselect '2004-06-24 08:10:30.000',17425,'Lester'
What i want to achieve is, to get the results as following:hour | work_time_minutes_within_hour | person------------------------------------------------6 | 40 | John17 | 18 | John18 | 57 | John19 | 60 | John110 | 60 | John111 | 48 | John18 | 21 | Jim110 | 57 | Jim111 | 60 | Jim112 | 60 | Jim113 | 60 | Jim1...where "work_time_minutes_within_hour" is a working time that a person worked from the date until date + working_time_second. If time overlaps the full hour, the calculation goes into next hour as shown in example.thank you for your ideas.