This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.* | |
FROM wp_postmeta AS pm | |
INNER JOIN wp_posts AS p ON pm.meta_value=p.ID | |
INNER JOIN wp_posts AS parent ON p.post_parent = parent.`ID` | |
WHERE pm.meta_key = '_thumbnail_id' | |
AND parent.post_status = 'publish' | |
/* You can add more conditions for posts like post type etc. */ | |
ORDER BY p.post_date DESC |