mysql 对返回的值是null进行判断和重新赋值

SELECT IFNULL(sum(c.tax_data),0) ,IFNULL(SUM(c.fiscal_ret),0)   FROM corp_tax c WHERE c.industry_id = 100
   
    and c.corp_year =2018 and c.corp_month =6 and c.status = 1 and park_id=1

使用ifnull(expr,expr) 来处理。上面的sql  sum(c.tax_data) 如果是null 则返回0.

原文地址:https://www.cnblogs.com/prader6/p/10916440.html