I have a query that returns a pet post if the meta_key exists and is not '':
-- Pets that are assigned tags
SELECT p.ID
FROM FxFfekP0_posts p LEFT JOIN FxFfekP0_postmeta pm
ON p.ID = pm.post_id
WHERE p.post_type = 'pets'
AND pm.meta_key = 'tag'
AND pm.meta_value != ''
But now I need to get a result set that contains posts that either do not contain the meta_key tag
at all, or the meta_key tag
= '' ...
Help?