关于null或者其他内容的替换如何实现?2019-06-25

image.png
image.png
image.png

当要查询的某字段下的记录为空时,替换为0或“无”或“未知”如何实现?

使用 (case when ````` is null then "无" else ````` end) as ``````

延伸疑问:如果是1、2、3、4 ,要替换为A、B、C、D的话,

case when id=1 then 'A'
when id=2 then 'B'
when id=3 then 'C'
when id=4 then 'D'
else '其他' end

或者是按照时间段划分不同类别,查询出的内容进行对应匹配为文字,要怎么实现?
图片发自App

你可能感兴趣的:(关于null或者其他内容的替换如何实现?2019-06-25)