字段显示为空或空sting但我无法选择它

时间:2010-08-13 17:55:24

标签: postgresql

select *
from ss.mailer_data
where
id = 249122
and address_3 like'%%'

不会打到address_3。我已经尝试将最后一行更改为

and address_3 is null

and address_3 = ''

and address_3 = ' '

我尝试使用char_length,ascii函数,它们没有为该字段值返回任何内容。有人有什么想法吗?

2 个答案:

答案 0 :(得分:0)

也可能是id = 249122对于该组合​​不适用。

时会发生什么
select *
from ss.mailer_data
where address_3 is null

select *
from ss.mailer_data
where address_3 = ''

答案 1 :(得分:0)

NULL是一个特殊情况 - 它是未定义的,但如果这是你的问题,Null应该找到它

我可以问你在Address3中实际存储了哪些数据?

如果您只想要address3为空/空的所有记录,

select *
from ss.mailer_data
where
RTRIM(COALESCE(address_3, '')) =''

注意:LIKE的计算成本很高,因此请谨慎使用。此外,像'%%'与Like'%'

相同

你确定你有正确的身份证吗?