SELECT FROM WHERE = true

时间:2014-03-15 15:23:28

标签: mysql select where

我正在尝试选择填写字段的数据库条目。数据库有两种插入数据的方式,一种输入注释,一种不输入,我期待只选择填写了注释的行。

 $requete = "SELECT * FROM daysoff WHERE comment = true ORDER BY id";

哪里出错了?或者这样做的正确方法是什么?

2 个答案:

答案 0 :(得分:2)

您可以尝试:

$requete = "SELECT * FROM daysoff WHERE comment IS NOT NULL ORDER BY id";

答案 1 :(得分:0)

你必须尝试这个

$requete = "SELECT * FROM daysoff WHERE comment IS NOT NULL AND comment != '' ORDER BY id";