我能够获得总小时但我想如果计数是00:00输出应该是00:01
这是我的疑问。
SELECT reviews.id as review_id, COALESCE( name, 'N/A' )
FROM customers, reviews
WHERE customers.id = reviews.customer_id
答案 0 :(得分:0)
使用大小写尝试此查询:
SELECT
CASE CONVERT(varchar(3),DATEDIFF(minute,MIN(clock), MAX (clock))/60) + ':' + RIGHT('0' + CONVERT(varchar(2),DATEDIFF(minute,MIN (clock),MAX (clock))%'60'),2)
WHEN '0:00' THEN '00:01'
ELSE CONVERT(varchar(3),DATEDIFF(minute,MIN(clock), MAX (clock))/60) + ':' + RIGHT('0' + CONVERT(varchar(2),DATEDIFF(minute,MIN (clock),MAX (clock))%'60'),2)
END
as TotalHours