lundi 23 mars 2015

If meta_key exists then don't select this post?


I'm trying to select all posts EXCEPT ones with a meta_key somekey.



SELECT *
FROM wp_posts JOIN wp_postmeta
ON wp_posts.ID = wp_postmeta.post_id
WHERE meta_key != 'somekey'


But this is still selecting that post, because other meta_keys still match.


Basically, the effect I want is to enter a custom field named 'somekey', and then that post will not be selected.





Aucun commentaire:

Enregistrer un commentaire