Here's the deal. I'm modifying a WordPress theme to suit my needs and i'm struggling with the way WP has setup their database. I'm trying to setup a Query that will match a Post with it's Category ID, then match the category id with the category name. I need some sort of INNER or LEFT join in there, but I don't know which type of Join to use.
here's what i have
I'm pretty sure the first LEFT JOIN is right, but I don't think the INNER JOIN is right. any thoughts?
_______________
_brian.
here's what i have
Code:
SELECT *, DATE_FORMAT($wpdb->posts.post_date,'%c.%e.%Y') AS post_date2 FROM $wpdb->posts LEFT JOIN $wpdb->post2cat ON $wpdb->posts.ID = $wpdb->post2cat.category_id INNER JOIN $wpdb->categories ON $wpdb->post2cat.category_id = $wpdb->categories.cat_ID WHERE $wpdb->posts.post_date < '$now' AND $wpdb->posts.post_status = 'publish' ORDER BY $wpdb->posts.post_date DESC
I'm pretty sure the first LEFT JOIN is right, but I don't think the INNER JOIN is right. any thoughts?
_______________
_brian.