I need to show a list of exhibits from a database. Some are events (shows lasting only one day), marked with a checkbox. I don’t want to include those.
When running my Query without and selector, I get 103 results.
If I add this line
AND `event`.`meta_value` = 'on'
I get 23 results (the events). It works well.
If I add that line instead
AND `event`.`meta_value` != 'on'
I get 12 results. They are not events, but it is missing 68 posts.
I also tried using <>
instead of !=
with a similar result.
They other 68 posts most likely have
NULL
as value, you should also be able to see this for yourself if you check the database. They won’t show up with = or != … If you want to see them you’ll have to change your query to specifically look for the attribute beingNULL
: