jimbrown131
Member
Posted 11 months ago #
I love the Exports and Reports plugin, but am not really familiar with MySQL queries.
I want to write a report that joins WP_Posts with WP_postmeta tables so that I can write a report that contains data merged from both tables (i.e. trying to get custom fields on a report).
Any help would be greatly appreciated.
Thanks,
Jim
tedinoz
Member
Posted 11 months ago #
You need to write a query that JOINS the two tables.
This is a very crude example:
SELECT wp_posts.ID, wp_posts.post_type FROM wp_posts INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id WHERE 1 = 1 AND wp_postmeta.meta_key = '_wp_page_template'
While I was doing this, I came upon an excellent explanation in the codex called Displaying_Posts_Using_a_Custom_Select_Query.
Ted
jimbrown131
Member
Posted 11 months ago #
Thanks Ted!
I sure do appreciate the help and reference to the explanation from codex! My query is now working beautifully!!
Sorry for the delay, that looks right. Thanks for the help tedinoz!