SQLITE (fmdb) select where x is null not working SQLITE (fmdb) select where x is null not working sqlite sqlite

SQLITE (fmdb) select where x is null not working


NULL cannot be compared with the = operator; it is not equal with any value, even itself.

To compare with NULL, you have to use the IS NULL operator:

stmt = @"select * from test where shipToCode is null";


Try the following and check if there are any changes:

NSString *query = @"SELECT * FROM test WHERE shipToCode is NULL";FMResultSet *rs = [db executeQuery:query];int count = 0;while ([rs next]) {    count++;}NSLog(@"Count %d", count);