WordPress.org

Support

Support » Plugins and Hacks » Exports and Reports » [Resolved] Need help with query

[Resolved] Need help with query

  • 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

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    Thanks Ted!

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

    Plugin Author Scott Kingsley Clark

    @sc0ttkclark

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Need help with query’ is closed to new replies.
Skip to toolbar