ITPub博客

首页 > 数据库 > > DorisDB-SQL中Null和为空两个含义

DorisDB-SQL中Null和为空两个含义

作者:gaokeke123 时间:2022-07-28 10:38:52 0 删除 编辑


省份未空的话用0表示

SELECT belong_month,
if(province!='',province,0)
from tttt;



注意:如果使用SELECT belong_month,
if(province!=null,province,0)
from tttt;===》结果会出问题 要么改成is not null

主要害的看底表到底是null还是空‘ ’,如果是null的话直接is not null较为正规写法

如果是‘ ’的话用 != ‘ ’也行

SELECT belong_month,
if(province is not null,province,0)
from tttt





————————————————
版权声明:本文为CSDN博主「大数据小王」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_53150969/article/details/123994131

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26692020/viewspace-3168968/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
大家好

注册时间:2013-08-14

  • 博文量
    1432
  • 访问量
    31590