DMedian in access 2013, no values returned

前端 未结 1 516
感情败类
感情败类 2021-01-23 22:24

I have the following query in MS Access 2013 than does not return a Median value.

The field IU is always NULL (blank) or 1. Column GM is a number formatted 0.0000 betwe

相关标签:
1条回答
  • 2021-01-23 22:41

    Ask your DMedian expression to ignore any Nulls in the GM field.

    SELECT IU, DMedian("GM","tblFirst250","IU=1 AND GM Is Not Null") AS MedianByIU
    FROM tblFirst250
    WHERE IU = 1
    GROUP BY IU;
    

    Basically what happened is DMedian opened a recordset sorted by GM and then moved (roughly) half way through the recordset to get the median value. But if the value in that row happened to be Null ...

    GM
    --
    Null
    Null  <- median
    2
    

    ... DMedian told you the median is Null. So instructing DMedian to load only rows where GM Is Not Null gave you the median of the non-Null values.

    0 讨论(0)
提交回复
热议问题