Reputation: 2221
Cursor cursor = db.rawQuery("SELECT id,lastname FROM people WHERE lastname=null; ",null);
this query does not return the members whose lastname is empty. What is wrong with that query ? Should I check like that WHERE lastname="" ?
Upvotes: 0
Views: 170
Reputation: 83303
It is not possible to test for NULL
values with comparison operators, such as =
, <
, etc.
You have to use the IS NULL
and IS NOT NULL
operators instead.
SELECT id, lastname FROM people WHERE lastname IS NULL;
Upvotes: 1