MySQL - Find MIN but not zero

后端 未结 2 966

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:02

    Use this:

    MIN(NULLIF(value, 0))
    
    0 讨论(0)
  • 2020-12-28 16:08

    The correct answer for you is:

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

    While ISNULL not working.

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