select sum(休息时间) from table1 where [id]> (select id from table1 where stime <='8:45' and etime> ='8:45') and [id] <=(select id from table1 where stime <='9:30' and etime> ='9:30')
select sum(休息时间) from table2 where [id]>(select id from table2 where stime <='8:45' and etime>='8:45') and [id] <=(select id from table2 where stime <='9:30' and etime>='9:30')