samedi 31 janvier 2015

"!="/NOT perhaps not working properly in SQLite

I have a table with about a hundred rows. It has a column is_gallery that contains either 1, 0, or NULL. If I do...



SELECT * WHERE is_gallery != 1


or



SELECT * WHERE NOT (is_gallery = 1)


it excludes the rows where is_gallery is null. I can manage to get a proper response if I do



SELECT * WHERE (is_gallery = 0 OR is_gallery is null)


But shouldn't the "!=" or NOT work? Isn't there a way to just return the rows where is_gallery doesn't equal 1 without testing for every other possibility?


Aucun commentaire:

Enregistrer un commentaire