1 Reply Latest reply on Apr 28, 2014 8:44 AM by SkipGilleland

    SQL query question

    SkipGilleland

      Title

      SQL query question

      Post

           Not sure if this matters, but I 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.

           SELECT *
           FROM `wp_postmeta`
           WHERE `post_id` =22097
           AND `meta_key` LIKE '_my_meta_value_key'
            
           The attached image is what happens when I search for the post_id of 22097 in FM, not when I run the above mySQL query.

      Volleyball_Tryouts_-_2_.png

        • 1. Re: SQL query question
          SkipGilleland

               Ok, I am  progressing slowly....I have created a query in mySql that returns the post_id, post_name and the video_url.  How do I get this information into FM?

               Here is the query

          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 
               LIMIT 600 , 30