Find locations of all featured images of draft posts via SQL

Question

I’m trying to get the file locations of all featured images used in draft type posts via SQL and phpmyadmin.

posts type attachment should hold the location of the image in the guid column.

SELECT voybp_posts.guid
FROM voybp_posts
WHERE voybp_posts.ID IN (SELECT voybp_postmeta.meta_value
                        FROM voybp_postmeta
                        WHERE voybp_postmeta.meta_value = voybp_posts.ID
                        AND voybp_postmeta.meta_key="_thumbnail_id")

This currently returns the locations of ALL the post attachments, I think I need a subquery to find only the “draft” type posts but I’m a bit lost.

0
, , Adilicious 3 years 2020-03-28T08:50:50-05:00 0 Answers 87 views 0

Leave an answer

Browse
Browse