2010-10-23 57 views

回答

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 <> ''; 

如果想最後的查詢就可以使用索引,我不是很確定的第一。