sql中,如果字段类型允许为NULL,则当有字段数据为NULL时,sql语句做不等于筛选判断时要注意
null只能通过is null或者is not null来判断
例:
select * from bl_ip_dt where amount <> 800,这条语句查不出amount等于null 的记录
select * from bl_ip_dt where amount <> 800 or amount is null 是可以的
sql中,如果字段类型允许为NULL,则当有字段数据为NULL时,sql语句做不等于筛选判断时要注意
null只能通过is null或者is not null来判断
例:
select * from bl_ip_dt where amount <> 800,这条语句查不出amount等于null 的记录
select * from bl_ip_dt where amount <> 800 or amount is null 是可以的
本文标题:sql中的不等于<>,NULL需要单独判断
本文链接:https://www.haomeiwen.com/subject/coiightx.html
网友评论