Custom Select query
-
Hi, I want to filter my post by using a custom select query.
I use this query:global $wpdb; global $post; $querystr = " SELECT wposts.* FROM $wpdb->posts wposts LEFT JOIN $wpdb->postmeta wpostmeta ON wposts.ID = wpostmeta.post_id LEFT JOIN $wpdb->term_relationships ON (wposts.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.taxonomy = 'category' AND ($wpdb->term_taxonomy.term_id = 1 OR $wpdb->term_taxonomy.term_id = 2) AND ($wpdb->term_taxonomy.term_id = 5 OR $wpdb->term_taxonomy.term_id = 6) LIMIT 4 ";
But it gives back no results, what am I doing wrong?
thx,
Niels
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Select query’ is closed to new replies.