Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Cursor cursor = db.rawQuery("SELECT id,lastname FROM people WHERE lastname=null; ",null);
此查询不返回姓氏为空的成员。该查询有什么问题?我应该像这样检查 WHERE lastname="" 吗?
试试这个:
... WHERE lastname IS NULL;
无法NULL使用比较运算符(例如=,<等)测试值。
NULL
=
<
您必须改用IS NULLandIS NOT NULL运算符。
IS NULL
IS NOT NULL
SELECT id, lastname FROM people WHERE lastname IS NULL;