Complex query on WORDPRESS database – KML file creation
-
Hi guys,
this is my problem, i want to create a complex query that can select from the database all the necessary information for create a custom KML 2.1 file that i will overlay to a google map.
For do that i want to select all posts rows inside 1 category (category ID = 1) and all postmeta associated.
I found on codex this query:
SELECT * FROM lg_posts LEFT JOIN lg_postmeta ON(lg_posts.ID = lg_postmeta.post_id) LEFT JOIN lg_term_relationships ON(lg_posts.ID = lg_term_relationships.object_id) LEFT JOIN lg_term_taxonomy ON(lg_term_relationships.term_taxonomy_id = lg_term_taxonomy.term_taxonomy_id) WHERE lg_term_taxonomy.term_id = 1 AND lg_term_taxonomy.taxonomy = 'category' AND lg_posts.post_status = 'publish' AND lg_postmeta.meta_key = 'my_meta_key'
Now i want to mody that for get more meta_key values….but i’m not able to modify this query for add more meta_key…
I tried to add at the end of the query:
AND lg_postmeta.meta_key = 'my_meta_key_1' AND lg_postmeta.meta_key = 'my_meta_key_2' AND lg_postmeta.meta_key = 'my_meta_key_3'
But doesn’t work…
Can you help me ?
Thanks
- The topic ‘Complex query on WORDPRESS database – KML file creation’ is closed to new replies.