Could anyone help me how to write a SQL query to get the result like this?
post_title , (by) post_author, (under) cat_name ( and another cat_name if the post is in multiple categories)
My Query is
SELECT w1.post_title, w2.post_author, w4.cat_name FROM wp_posts w1, wp_users w2, wp_post2cat w3, wp_categories w4 where w1.post_author = w2.ID and w1.ID = w3.post_id and w3.category_id = w4.cat_ID;
However, when a post is in multiple categories, this query won't work.
Please show me how to write this query. Thank you.