I need to get records from my wordpress database of the users whos certain metakey (event_date) has value not null or not empty (event_date != ”)? and another certain metakey (multidate) does not exist.
I am trying:
SELECT *
FROM wp_posts
LEFT JOIN wp_postmeta
ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_postmeta.event_date != ''
AND NOT EXISTS (
SELECT * FROM wp_postmeta
WHERE wp_postmeta.meta_key = 'multidate'
AND wp_posts.ID = wp_postmeta.post_id
)
But no luck. I think what might be giving issue is the portion
"AND wp_postmeta.event_date != ''"
Bu I am not sure. I am not sure what else to try.
Could you please help?