Hi,
I am trying to get the thumbnail meta data for the posts in my wordpress blog together with their category and some other data. The thumbnail data is serialized and I will unserialize it later.
Here is the query I have:
SELECT wpostmeta.meta_value AS url,
wposts.post_content, wposts.post_title, wposts.post_status, wposts.post_name,
cat_terms.name AS category_name, cat_terms.term_id AS category_id,
ttable.meta_value AS thumb_data
FROM `wp_postmeta` AS wpostmeta,
`wp_posts` AS wposts
INNER JOIN wp_term_relationships AS cat_term_relationships ON (wposts.ID = cat_term_relationships.object_id)
INNER JOIN wp_term_taxonomy AS cat_term_taxonomy ON (cat_term_relationships.term_taxonomy_id = cat_term_taxonomy.term_taxonomy_id AND cat_term_taxonomy.taxonomy = 'category')
INNER JOIN wp_terms AS cat_terms ON (cat_term_taxonomy.term_id = cat_terms.term_id)
LEFT JOIN `wp_postmeta` AS ttable ON (wposts.ID = ttable.post_id AND ttable.meta_key = '_wp_attachment_metadata')
WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'url'
AND wposts.post_type = 'post'
Everything works except for the attachment part. 'thumb_data' is NULL.
Could you please help me fix this?