如何在SQL Server中将hh:mm:ss转换为hh:mm?
select Count(Page) as VisitingCount,Page,CONVERT(VARCHAR(8),Date, 108) from scr_SecuristLog
where Date between '2009-05-04 00:00:00' and '2009-05-06 14:58'
and [user] in(select USERNAME
from scr_CustomerAuthorities )
group by Page,Date order by [VisitingCount] asc
hh:mi:ss
。使用类似于内存技巧的方法来缩短时间似乎是一种不受支持的做法,在新版本中可能会突然出现问题。 - J. Minihh:mi:ss
,但是将varchar(5)
作为第一个参数传递会将结果截断为前5个字符。在SQL Server 2012+中,可以参考我的答案这里中提供的一个不错的解决方案。 - undefined