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.
if you give any numeric value to the function without any from clause it will give NULL. "The STDEV function uses all of the values to calculate the standard deviation. There must be at least two values in the field or the standard deviation will not be calculated and a NULL is returned."
The STDEV function computes the standard deviation for the selected rows. It is the square root of the VARIANCE function. You can apply the STDEV function only to numeric columns.
COUNT never returns null. The following example calculates, for each employee in the employees table, the moving count of employees earning salaries in the range 50 less than through 150 greater than the employee's salary.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With