Here is my code
SELECT * FROM categories
LEFT JOIN cat_meta ON cat_meta.cat_id = categories.cat_id
WHERE cat_meta.meta_key = 'Delete'
AND cat_meta.meta_value <> 1
What I want is to retrive all the categories that dont have a meta_value of 1. This could mean if the category meta_value was not set, or if the meta_value = 0.
Instead whats happening is im getting a list of categories that have been set to meta_value = 0
How should i rewrite this?
One way is to explicitly check for NULL (the other one is to use NVL(), but I don’t know whether that is portable):
Beware: this will not return categories that have no entry for meta_key = ‘Delete’ at all!