mysql 查询开始、结束时间差,并进行时间汇总

select   SEC_TO_TIME( sum(TIME_TO_SEC(TIMEDIFF(a.endDate,a.startDate))) )   aa
from  attendfilltb a,
usertb u
where
a.declarationTypeId= '1355710471434'
and a.createUid = u.id
and u.empId = '1363075075516';


TIMEDIFF  --计算时间差
TIME_TO_SEC  时间转
sum 汇总
SEC_TO_TIME  转

你可能感兴趣的:(mysql)