1.使用concat,如果某列为空,那么concat的结果也为空
解决方案
IFNULL(kh.`build_name`,'')
IFNULL函数,如果为空则用后面设定的值
2.使用case when时
CASE kh.`unit_name` WHEN NULL THEN ''ELSE '-' END
上面的sql无法判断是否为空
CASE WHEN kh.`unit_name` IS NULL THEN ''ELSE '-' END
应使用 is null来判断
1.使用concat,如果某列为空,那么concat的结果也为空
解决方案
IFNULL(kh.`build_name`,'')
IFNULL函数,如果为空则用后面设定的值
2.使用case when时
CASE kh.`unit_name` WHEN NULL THEN ''ELSE '-' END
上面的sql无法判断是否为空
CASE WHEN kh.`unit_name` IS NULL THEN ''ELSE '-' END
应使用 is null来判断