我了解无法直接对别名执行计算,但是有没有办法可以找到别名的总和(总时间)?我在这里先向您的帮助表示感谢。
SELECT *,
TIMEDIFF( time2, time1 ) ,
TIMEDIFF( time4, time3 ) ,
ADDTIME( TIMEDIFF( time2, time1 ) ,
TIMEDIFF( time4, time3 ) ) ,
TIME_FORMAT( ADDTIME( TIMEDIFF( time2, time1 ) ,
TIMEDIFF( time4, time3 ) ) , '%H:%i' )
AS totaltime
SUM(SELECT(totaltime)) AS sumtotal
FROM
timer
WHERE
groupid='100'
AND
MONTH(`date`) = MONTH(NOW())
GROUP BY userid