当表格仅包含一行时,StDev()函数返回Null [英] StDev() function returns Null when table contains only one row

查看:77
本文介绍了当表格仅包含一行时,StDev()函数返回Null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用StDev函数并获得空白结果.我将其用作...

I am trying to use the StDev function and am getting blank results. I am using it as...

SELECT StDev(fldMean) FROM myTable

其中fldMean包含2.3的值,并且应求值为0,但我只是得到一个空结果.我似乎无法理解该函数中如何使用表达式,微软的手册确实没有帮助.

Where fldMean contains a value of 2.3 and should evaluate to 0 but instead I am simply getting an empty result. I can't seem to understand how expressions are to be used in the function, Microsoft's manual really didn't help.

推荐答案

SELECT StDev(fldMean) FROM myTable

如果[myTable]只有一行,则

将返回Null,因为无法从单个观察值计算出标准偏差.在收到有意义的结果之前,该表中至少需要两行.如果您想将Null值强制设置为零,则可以使用

will return Null if [myTable] has only one row because the Standard Deviation cannot be computed from a single observation. You will need at least two rows in that table before you can receive a meaningful result. If you want to force the Null value to zero you can use

SELECT Nz(StDev(fldMean), 0) FROM myTable

这篇关于当表格仅包含一行时,StDev()函数返回Null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆