From b99cbd1d893ff0a730ab7187f409bcdf3c6f4aeb Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Wed, 16 Mar 2005 08:27:14 +0000 Subject: Bug 174295: ANSI SQL requires all columns in SELECT to be in GROUP BY, unless they are in "aggregate" functions Patch By Tomas Kopal r=joel, a=myk --- editcomponents.cgi | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'editcomponents.cgi') diff --git a/editcomponents.cgi b/editcomponents.cgi index a8d1f1f90..9a1e7934e 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -139,8 +139,9 @@ unless ($product) { if ($showbugcounts){ SendSQL("SELECT products.name, products.description, COUNT(bug_id) - FROM products LEFT JOIN bugs ON products.id = bugs.product_id - GROUP BY products.name + FROM products LEFT JOIN bugs + ON products.id = bugs.product_id " . + $dbh->sql_group_by('products.name', 'products.description') . " ORDER BY products.name"); } else { SendSQL("SELECT products.name, products.description @@ -184,17 +185,19 @@ unless ($action) { my @components = (); if ($showbugcounts) { - SendSQL("SELECT name,description, initialowner, + SendSQL("SELECT name, description, initialowner, initialqacontact, COUNT(bug_id) - FROM components LEFT JOIN bugs ON - components.id = bugs.component_id - WHERE components.product_id = $product_id - GROUP BY name"); + FROM components LEFT JOIN bugs + ON components.id = bugs.component_id + WHERE components.product_id = $product_id " . + $dbh->sql_group_by('name', + 'description, initialowner, initialqacontact')); } else { SendSQL("SELECT name, description, initialowner, initialqacontact FROM components - WHERE product_id = $product_id - GROUP BY name"); + WHERE product_id = $product_id " . + $dbh->sql_group_by('name', + 'description, initialowner, initialqacontact')); } while (MoreSQLData()) { -- cgit v1.2.3-24-g4f1b