MySQL如何正确查询字段为NULL的字段

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$tk_Ids = M("LsnSelected")->where("use_tool=8 AND tk_roomId is null")->select();        (正确)

$tk_Ids = M("LsnSelected")->where("use_tool=8 AND tk_roomId=NULL")->select();      (错误)

==========================================================================================================

说明:

1、查询字段值为空的语法:where <字段名> is null
2、查询字段值不为空的语法:where <字段名> is not null

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

posted @ 2018-03-01 14:42  Mr.peter  阅读(33876)  评论(1编辑  收藏  举报