Created
February 14, 2011 21:25
-
-
Save ldhertert/826580 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM wp_posts | |
LEFT JOIN wp_term_relationships ON(wp_posts.ID = wp_term_relationships.object_id) | |
LEFT JOIN wp_term_taxonomy tax_type ON(wp_term_relationships.term_taxonomy_id = tax_type.term_taxonomy_id) | |
LEFT JOIN wp_term_taxonomy tax_client ON(wp_term_relationships.term_taxonomy_id = tax_client.term_taxonomy_id) | |
LEFT JOIN wp_terms terms_type ON(tax_type.term_id = terms_type.term_id) | |
LEFT JOIN wp_terms terms_client ON(tax_client.term_id = terms_client.term_id) | |
WHERE wp_posts.post_type = 'portfolio' | |
AND wp_posts.post_status = 'publish' | |
AND tax_type.taxonomy = 'type' | |
AND tax_client.taxonomy = 'client' | |
AND terms_type.slug = 'web' | |
AND terms_client.slug = 'microsoft' | |
ORDER BY wp_posts.post_date DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this works:
SELECT *
FROM wp_posts
LEFT JOIN wp_term_relationships ON(wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy tax_type ON(wp_term_relationships.term_taxonomy_id = tax_type.term_taxonomy_id)
LEFT JOIN wp_terms terms_type ON(tax_type.term_id = terms_type.term_id)
WHERE wp_posts.post_type = 'portfolio'
AND wp_posts.post_status = 'publish'
AND tax_type.taxonomy = 'type'
AND terms_type.slug = 'web'
ORDER BY wp_posts.post_date DESC