Page 1 of 1

SQL Exporter

PostPosted: Mon Apr 28, 2014 9:40 am
by sgilleland
I am trying to get this to work...

have an ODBC connection with my Wordpress site and I need to get some information into a field in Filemaker with a calculation...just not sure on the calculation.

2 tables (wp_posts, wp_postmeta)

I have them connected correctly wp_post:id -> wp_postmeta:post_id

Within the postmeta table there are three other fields (meta_id, meta_key, meta_value)

I am trying to get all of the values within the field "meta_key" of "_my_meta_value_key".

Here is the Query my developer gave me..not sure if it helps, but incase I missed something.

Code: Select all
SELECT wp_posts.ID, wp_posts.post_title, pm1.meta_value as video_url FROM wp_posts
LEFT JOIN wp_postmeta AS pm1 ON (wp_posts.ID = pm1.post_id AND pm1.meta_key='_my_meta_value_key')
 WHERE wp_posts.post_type = 'post' AND wp_posts.post_status = 'publish' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC

Re: SQL Exporter

PostPosted: Mon Apr 28, 2014 4:28 pm
by jeffalmquist
We don't have any experience specifically querying a WordPress database. I would suggest you post this question on a SQL and/or WordPress forum. Sorry I don't have better guidance. -Jeff