0
A
回答
0
如果你做select * from atable where text_field;
,你会得到text_field ='1'的行。
类似于select * from atable where text_field='1';
。
我不确定我是否理解这个问题。
0
出错。
我最好的猜测是你想要select * from table where text_field is not null
。
0
ceteras是正确的,WHERE text_field
返回true,其中text_field ='1'(出于某种不明原因)。
但是,请注意:NULL不等于空字符串(NULL甚至不等于NULL!)。如果你想选择的每一行,其中列text_field不空,你会做这样的事情:
SELECT * FROM table WHERE LENGTH(text_field) > 0;
-- or
SELECT * FROM table WHERE text_field <> '';
如果想最后的查询就可以使用索引,我不是很确定的第一。
你试过了吗?你得到了什么? – eumiro 2010-10-23 06:16:45