Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5534

somerandomdude2 on "Need MySQL query to return post_id and meta_value if another meta_value is = 1"

$
0
0

I have 2 custom fields in the postmeta table: 'adults_only' and 'video_url'

I need a MySQL query get the post_id and video_url of rows if the value of adults_only = 1

So far I have:

SELECT post_id, meta_key, meta_value
FROM wp_postmeta
WHERE meta_key = 'video_url' OR meta_key = 'await_thumb' AND meta_value != ''

Only problem is, it returns rows with meta_key = 'adults_only' which I don't need. I only need the post_id and video_url. Thanks.


Viewing all articles
Browse latest Browse all 5534

Trending Articles