StDev() function returns Null when table contains only one row

南笙酒味 提交于 2019-12-10 04:08:07

问题


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

SELECT StDev(fldMean) FROM myTable

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.


回答1:


SELECT StDev(fldMean) FROM myTable

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


来源:https://stackoverflow.com/questions/20937087/stdev-function-returns-null-when-table-contains-only-one-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!