How to treat MAX() of an empty table as 0 instead of NULL

前端 未结 3 1243
情书的邮戳
情书的邮戳 2020-12-29 23:15

I try to select max value from table

SELECT MAX(cid) FROM itemconfiguration;

However when table itemconfiguration is empty th

3条回答
  •  星月不相逢
    2020-12-30 00:12

    Can replace a number when max return null using ISNULL ,

    ISNULL(MAX(cid),0) FROM itemconfiguration;
    

提交回复
热议问题