Missing DISTINCT keyword

This commit is contained in:
Mike Jolley 2016-12-10 12:51:15 +00:00
parent 0ce99fbdbb
commit df057abe88
1 changed files with 1 additions and 1 deletions

View File

@ -124,7 +124,7 @@ class WC_Widget_Rating_Filter extends WC_Widget {
$meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' );
$tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' );
$sql = "SELECT COUNT( {$wpdb->posts}.ID ) FROM {$wpdb->posts} ";
$sql = "SELECT COUNT( DISTINCT {$wpdb->posts}.ID ) FROM {$wpdb->posts} ";
$sql .= $tax_query_sql['join'] . $meta_query_sql['join'];
$sql .= " WHERE {$wpdb->posts}.post_type = 'product' AND {$wpdb->posts}.post_status = 'publish' ";
$sql .= $tax_query_sql['where'] . $meta_query_sql['where'];