首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql 计算标准差?该怎么处理

2012-12-20 
sql 计算标准差?现在要计算标准差 http://baike.baidu.com/view/78339.htm求解sql里怎么计算?是不是有什么

sql 计算标准差?
现在要计算标准差 http://baike.baidu.com/view/78339.htm

求解sql里怎么计算?是不是有什么公式之类的,
假设表为 a  b
其中a为数值  b为日期,我想取出一段时间内的标准差,求解。
[最优解释]
select  a ,b from 
(select *,[st]=stdev(a)over() from tb where b between .. and ..)
where a>[st]
[其他解释]
不会啊,帮顶~ 
[其他解释]
STDEV() 这个函数可以 我找到了
[其他解释]
select stdev(a) from tb where b between .. and ..
[其他解释]

引用:
select stdev(a) from tb where b between .. and ..



如果现在希望把 select stdev(a) from tb where b between .. and ..  用于结果判断中怎么办?

就是  希望如  select  a ,b from tb where a>( select stdev(a) from tb where b between .. and ..)
这种是一种办法,但是因为在判断条件中加了计算,貌似会重复计算很多次影响效率,请问有什么好的办法?
[其他解释]
select  a ,b from 
 (select *,[st]=stdev(a)over() from tb where b between .. and ..) t
 where a>[st] 

热点排行