WordPress.org

Ready to get started?Download WordPress

Forums

Exports and Reports
[resolved] Meta data in excel (7 posts)

  1. mihaita
    Member
    Posted 1 year ago #

    Hi there, awesome plugin, I have managed to understand how write the sql query to call the custom post and it's meta_values from what meta_keys i want. the only problem is that they don't show up in the csv, Can you tell me what I need to enter in a field to display my meta data ?

    Thanks

    http://wordpress.org/extend/plugins/exports-and-reports/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    To add multiple fields per post, you'll have to do a join for each meta value, then select the join_alias.meta_value AS your_field, and make the corresponding change in the fields below.

  3. mihaita
    Member
    Posted 1 year ago #

    thanks, it did work in some way, i think my join is not ok now, this is my sql:
    SELECT
    ID,post_title, meta_key, meta_value
    FROM wp_posts
    LEFT JOIN wp_postmeta ON post_id = wp_posts.ID AND meta_key IN ('', 'factura_adresa', 'factura_tensiune', 'factura_cantitate', 'factura_pret1', 'factura_pret2', 'factura_tg', 'factura_tl', 'factura_servicii', 'factura_piata')
    WHERE wp_posts.post_type = 'facturi'
    AND (wp_posts.post_status = 'publish')

    the field config
    http://awesomescreenshot.com/0edzyla7c

    and here is the output i'm getting:
    http://awesomescreenshot.com/01czylj85

    I want each value on a separate column, i was trying this
    SELECT
    post_title,
    denumire.meta_value as denumire,
    tensiune.meta_value as tensiune,
    FROM wp_posts
    LEFT JOIN wp_postmeta AS denumire ON denumire.post_id=ID AND denumire.meta_key='factura_denumire'
    LEFT JOIN wp_postmeta AS tensiune ON tensiune.post_id=ID AND tensiune.meta_key='factura_tensiune'
    WHERE wp_posts.post_type = 'facturi'
    AND (wp_posts.post_status = 'publish')

    but i get a sql error.

    Thanks

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Please post the SQL error, I can't help you as quickly without it.

  5. mihaita
    Member
    Posted 1 year ago #

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM wp_posts LEFT JOIN wp_postmeta AS denumire ON denumire.post_id=ID AND denu' at line 5

  6. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    You have one too many commas, take out the comma after 'tensiune.meta_value as tensiune,'

  7. mihaita
    Member
    Posted 1 year ago #

    yeah, you are right , damm commas, thank you very much, works like a charm , 5* plugin

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.