您的位置:首页 > 其它

hql实践总结

2011-08-25 16:38 162 查看
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

这一句是正确的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: