• Hi,

    I wanna display posts from a certain category. I found the following rather complicated query on www.remarpro.com which returns posts from a certain category tagged with ‘paragraf’. All I did was on selecting “post_content”, deleting the ‘paragraf’ condition and changing the category so it selects posts from the category named ‘Kontakt’ (which is contact in german) instead of categories 1,2,3.

    $querystr = "SELECT post_content FROM $wpdb->posts
    LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
    LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)
    LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
    WHERE $wpdb->term_taxonomy.term_id = (SELECT term_id FROM $wpdb->terms WHERE name = 'Kontakt')
    AND $wpdb->term_taxonomy.taxonomy = 'category'
    AND $wpdb->posts.post_status = 'publish'
    ORDER BY menu_order, ID ASC";

    The result is that it returns an array containing each “post_content” from posts of the contact-category 2 times.

    Does anyone have a clue how to fix this?

    Thanks
    Luke

  • The topic ‘Example Query from www.remarpro.com returns same results twice’ is closed to new replies.