I have the following query which returns a list of 8 post ids for wordpress, i want to then take those 8 ids and match them to the id’s from the wp_posts table and get * details so i can echo post titles and all that, is there a way i can do that in one query? .. here is what i currently have
SELECT postid FROM wp_popularpostsdata WHERE DATE_SUB(CURDATE(),INTERVAL 60 DAY) <= day
AND wp_popularpostsdata.postid NOT IN (
SELECT object_id
FROM wp_term_relationships AS r
JOIN wp_term_taxonomy AS x ON x.term_taxonomy_id = r.term_taxonomy_id
JOIN wp_terms AS t ON t.term_id = x.term_id
WHERE x.taxonomy = 'category'
AND t.term_id IN (3,1))
GROUP BY postid
ORDER BY pageviews DESC LIMIT 8;
Cheeers,
Have you tried joining the tables?
Replace
wp_posts.idwith the key field in wp_posts