How do I optimize this query?

Posted by InnateDev on Stack Overflow See other posts from Stack Overflow or by InnateDev
Published on 2010-03-18T15:02:03Z Indexed on 2010/03/18 15:11 UTC
Read the original article Hit count: 275

Filed under:
|
SELECT DISTINCT wposts.* 
    FROM wp_2_posts wposts, wp_2_postmeta wpostmeta, wp_2_postmeta wpostmeta1, wp_2_term_taxonomy, wp_2_terms, wp_2_term_relationships
    WHERE wposts.ID = wpostmeta.post_id
    AND wp_2_terms.term_id = '8'
    AND wp_2_term_taxonomy.term_id = wp_2_terms.term_id
    AND wp_2_term_taxonomy.term_taxonomy_id = wp_2_term_relationships.term_taxonomy_id
    AND wp_2_term_relationships.object_id = wposts.ID
    AND wpostmeta.meta_key = 'validity'
    AND wpostmeta.meta_value > '".$logic_date."'    
AND wpostmeta1.meta_key != 'permanent'  
    AND wposts.post_status = 'publish' 
    AND wposts.post_type = 'post'
    ORDER BY wposts.post_date DESC

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql