Eliminating duplicate posts from SQL query
-
Hi everyone, I’m using this code
function miniposts_join($posts) { global $wpdb; if (is_home()) { $posts .= " LEFT JOIN $wpdb->term_relationships AS relacion ON ($wpdb->posts.ID = relacion.object_id ) LEFT JOIN $wpdb->term_taxonomy AS taxonomia ON(relacion.term_taxonomy_id = taxonomia.term_taxonomy_id) "; } return $posts; } function miniposts_where($posts) { if (is_home()) { $posts .= " AND taxonomia.term_id <> 12 AND taxonomia.taxonomy = 'category' "; } return $posts; }
but it throws duplicate posts. The duplicate posts arise whenever they are in two or more categories. Since I’m not fluent in sql I need to ask you, how can I tell the db that I only want those posts once?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Eliminating duplicate posts from SQL query’ is closed to new replies.