hql实践总结

来源:互联网 发布:欧菲斯办公软件 编辑:程序博客网 时间:2024/06/15 18:05
1.select * from tb1 where dt = '20110824' and id<>'' and id is not null
这一句是错的
2.
id<>''这句会转换为id<>cast('' as int)
cast('' as int)=null,null与任何逻辑操作符的比较结果都是NULL,在过滤时按false处理
需要这么比较的话可能要cast(id as string)<>''
3.select * from tb1 where dt = '20110824' and cast(id as string)<>'' and id is not null
这一句是正确的
原创粉丝点击