[wp-trac] [WordPress Trac] #10576: Use subqueries for taxonomy queries
WordPress Trac
wp-trac at lists.automattic.com
Mon Aug 10 00:44:37 UTC 2009
#10576: Use subqueries for taxonomy queries
----------------------------+-----------------------------------------------
Reporter: ryan | Owner: filosofo
Type: task (blessed) | Status: new
Priority: normal | Milestone: 2.9
Component: Taxonomy | Version:
Severity: normal | Keywords:
----------------------------+-----------------------------------------------
Comment(by ryan):
Sample query:
{{{
SELECT $wpdb->posts.ID FROM $wpdb->posts WHERE
$wpdb->posts.ID IN (
SELECT $wpdb->term_relationships.object_id FROM
$wpdb->term_relationships
WHERE $wpdb->term_relationships.term_taxonomy_id IN (
SELECT $wpdb->term_taxonomy.term_taxonomy_id FROM
$wpdb->term_taxonomy
WHERE $wpdb->term_taxonomy.term_id = '$cat_id' AND
$wpdb->term_taxonomy.taxonomy = 'category'
)
)
AND $wpdb->posts.post_type = 'post'
AND $wpdb->posts.post_status = 'draft' "
ORDER BY $wpdb->posts.post_date DESC LIMIT $limit OFFSET $offset
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10576#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list