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.
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
Please post the SQL error, I can’t help you as quickly without it.
#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
You have one too many commas, take out the comma after ‘tensiune.meta_value as tensiune,’
yeah, you are right , damm commas, thank you very much, works like a charm , 5* plugin