0
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
4

0 回答 0