【mysql】sum处理null的结果

 
SELECT
    IFNULL(sum(security_code_total), 0) createSCNum,
    IFNULL(sum(print_num), 0) privateScNum
FROM
    security_code_config
WHERE
    tid = 'test_tenement_123'
AND 
    DATE_FORMAT(create_date, '%Y-%m') = DATE_FORMAT('2019-03-01 11:32:54','%Y-%m')

使用IFNULL(查询值,0)

猜你喜欢

转载自www.cnblogs.com/sxdcgaq8080/p/10455420.html
今日推荐