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
这一句是正确的
这一句是错的
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
这一句是正确的
相关文章推荐
- NHibernate实践总结(二) 在mapping文件中设置抓取策略对HQL与Criteria造成不同影响的测试与验证
- NHibernate实践总结(三)HQL的theta-style join对无关联实体的连接与应用
- NHibernate实践总结(三)HQL的theta-style join对无关联实体的连接与应用
- stf在Linux/macOSX上的安装过程(实践中一步一步操作总结的)
- QTP实践总结
- 海量服务实践──手 Q 游戏春节红包项目设计与总结(上篇)
- HQL总结
- mysql乐观锁总结和实践
- phpcms v9 部署站点实践及总结
- mysql悲观锁总结和实践
- gluster分布式存储总结与实践
- WebSphere7集群部署实践与总结
- 单片机理论与实践课程总结与补充材料
- mysql悲观锁总结和实践
- 前端性能优化实践方案总结
- Android&Java实践总结
- strust2实践总结
- 断篇-金融大数据最佳实践总结篇
- 总结移动开发实践中遇到的坑
- 推荐系统实践第1章总结