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
这一句是正确的