你能帮我找一下'Count_of_Attno'数据集的AVG吗?
AttNo as'Count_of_Attno'是nvarchar。
SELECT CONVERT(CHAR(10), ArrDateTime, 120) as [Date],
count(AttNo) as Count_of_Attno
FROM [dbo].[Main]
GROUP BY CONVERT(CHAR(10), ArrDateTime, 120)
Order by CONVERT(CHAR(10), ArrDateTime, 120) desc
谢谢!
答案 0 :(得分:0)
这是一种在没有子查询的情况下获得平均值的简单方法:
SELECT COUNT(AttNo) / COUNT(DISTINCT CONVERT(CHAR(10), ArrDateTime, 120)) as avg_count
FROM [dbo].[Main];