• Resolved somerandomdude2

    (@somerandomdude2)


    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 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need MySQL query to return post_id and meta_value if another meta_value is = 1’ is closed to new replies.