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

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

作者: 可乐要坚持学习 | 来源:发表于2019-06-28 17:43 被阅读0次
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

或者是按照时间段划分不同类别,查询出的内容进行对应匹配为文字,要怎么实现? 关于null或者其他内容的替换如何实现?2019-06-25

相关文章

网友评论

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

      本文链接:https://www.haomeiwen.com/subject/jthzqctx.html