I am trying to output the post details, as well as some custom fields in wordpress's database. I have custom fields called 'thumbnail' and 'video'
SELECT ID, post_title, post_content, wp_postmeta.meta_value
FROM wp_posts
INNER JOIN wp_postmeta ON wp_posts.id=wp_postmeta.post_id
WHERE wp_postmeta.meta_key = "thumnail"
OR wp_postmeta.meta_key = "video"
So far I am getting individual rows like this:
| ID | Title | Content | Custom Fields |
|--------------------------------------------------------------------|
| 234 | INCEPTION | Content etc | wp-content/thumbnail/inception.jpg |
| 234 | INCEPTION | Content etc | wp-content/video/inception.flv |
but what i would like is (ie one line per post)
|ID |Title |Content |Thumbnail |Video |
|-----------------------------------------------------------------------------------|
|234|INCEPTION |Content etc |wp-content/..inception.jpg |wp-content/..inception.flv |
Could someone advise on how to separate the different values into columns within the SELECT statement?