查询为空显示默认值

SELECT cc.`COMPANY_ID` COMPANY_ID,cc.`COMPANY_NAME` COMPANY_NAME,IFNULL(ccpt.`NAME`,'defalut') NAME FROM cblej_company cc
LEFT JOIN cblej_company_pc_templates ccpt ON cc.`COMPANY_ID` = ccpt.`REL_ID`
where cc.`COMPANY_ID` = 802

原文地址:https://www.cnblogs.com/apolloren/p/9966195.html