1

I have to use from sqlite DB and I insert many data in my sqlite file. now I want execute records that has "NULL". in oder word I want to see records that are "NULL". when I execute this code I nothing get.

    select  * from table1 where ParentID = NULL 
   //or this select  * from table1 where ParentID = 'NULL'

this is my sqlite file :

enter image description here

I want execute folder1 with checking ParentID (I need only check ParentID column)

4

4 回答 4

6

NULL永远不等于任何东西,包括NULL. 你需要IS改用。

SELECT * FROM table1 WHERE ParentID IS NULL 
于 2013-05-16T12:29:40.280 回答
5

您必须使用以下内容:

select  * from table1 where ParentID is NULL 
于 2013-05-16T12:28:57.777 回答
2

NULL值表示缺失的未知数据。默认情况下,表列可以保存 NULL 值。NULL 值的处理方式与其他值不同。

 SELECT * FROM table1 WHERE ParentID IS NULL

始终使用 IS NULL 来查找 NULL 值。

于 2013-05-16T12:34:53.523 回答
0

你应该使用IS NULL. (比较运算符=<>都在表达式的任一侧给出了带有 NULL 的 UNKNOWN。)

SELECT * FROM table1 WHERE ParentID IS NULL;
于 2013-05-16T12:43:02.717 回答