MySQL - Find MIN but not zero

后端 未结 2 964

I am trying to fetch the minimum value of a column in MySQL using the MIN function. But is it possible to tell MySQL to ignore the zero values? Problem is that

2条回答
  •  礼貌的吻别
    2020-12-28 16:08

    The correct answer for you is:

    IFNULL(MIN(NULLIF(value, 0)), 0)
    

    While ISNULL not working.

提交回复
热议问题