Date Event eventid username starttime Endtime Remark Totaltime
----------------------------------------------------------------------------------------
05/30/2012 Break Out 0 Premnath Nair **13:06:06** 13:06:06 NULL 00:00:00
05/30/2012 Break In 1 Premnath Nair **13:22:24** 13:22:24 NULL 00:00:00
05/30/2012 NULL 255 Premnath Nair 08:54:49 19:21:02 normal 10:26:13
05/31/2012 NULL 255 Premnath Nair 07:52:55 18:50:45 normal 10:57:50
06/01/2012 NULL NULL NULL NULL NULL NULL
06/02/2012 NULL NULL NULL NULL NULL NULL
06/03/2012 Break Out 0 Premnath Nair 13:32:55 13:32:55 NULL 00:00:00
06/03/2012 Break In 1 Premnath Nair 13:43:11 13:43:11 NULL 00:00:00
06/03/2012 Out Duty 2 Premnath Nair 12:03:52 12:03:52 NULL 00:00:00
这是来自数据库的数据
我通过这个查询得到了总时间
convert (varchar(8), convert(datetime, endtime, 8) - convert(datetime, starttime, 8), 108) as totaltime
需要知道如何获得总休息时间需要添加休息时间和休息时间