SQL语句求平均值,急求!!!

2025-03-10 18:03:59
推荐回答(3个)
回答1:

sum(score)/datediff(hour, startdate, enddate)/24.0

回答2:

select id,sum(id) over (order by 排序字段) / count(id) over (order by 排序字段)
from (
select 1 id,1 排序字段
union all select 2,2
union all select 3,3
union all select 2,4
) t

回答3:

有平均值函数的avg(a1+a2+a3)