diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 4a82edfd0c6..a339c87f569 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -246,8 +246,8 @@ class CommandeStats extends Stats $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql .= " FROM ".$this->from; - $sql .= " LEFT JOIN ".$this->from_line." ON c.rowid = tl.fk_commande "; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; + $sql .= " INNER JOIN ".$this->from_line." ON c.rowid = tl.fk_commande "; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); }