Exports and Reports
[resolved] Need help with query (4 posts)

  1. jimbrown131
    Posted 4 years 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.



  2. tedinoz
    Posted 4 years 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.


  3. jimbrown131
    Posted 4 years ago #

    Thanks Ted!

    I sure do appreciate the help and reference to the explanation from codex! My query is now working beautifully!!

  4. Scott Kingsley Clark
    Plugin Author

    Posted 4 years ago #

    Sorry for the delay, that looks right. Thanks for the help tedinoz!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Exports and Reports
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic