Name a b c
sam 1 2 3
sam 4 3 2
tom 5 5 2
tom 2 4 7
fred 2 3 5
fred 1 2 3
我使用以下查询生成方差:
select n,sum((b-f)*(b-f))/(count(b)-1) from test,(select name as n,avg(b) as f from test group by name ) as j where j.n==name group by name ;
当我运行查询时,我得到以下结果。为什么我要为山姆空白?
n sum((b-f)*(b-f))/(count(b)-1)
fred 0.5
sam
tom 0.5