summaryrefslogtreecommitdiffstats
path: root/editclassifications.cgi
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-03-16 09:27:14 +0100
committermkanat%kerio.com <>2005-03-16 09:27:14 +0100
commitb99cbd1d893ff0a730ab7187f409bcdf3c6f4aeb (patch)
treeb2769bdde9c44eefd7834dcbc18e67e66d6d1aa9 /editclassifications.cgi
parent94dcd5edee079a1bb67a0011711d25a4be0f14c6 (diff)
downloadbugzilla-b99cbd1d893ff0a730ab7187f409bcdf3c6f4aeb.tar.gz
bugzilla-b99cbd1d893ff0a730ab7187f409bcdf3c6f4aeb.tar.xz
Bug 174295: ANSI SQL requires all columns in SELECT to be in GROUP BY, unless they are in "aggregate" functions
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=joel, a=myk
Diffstat (limited to 'editclassifications.cgi')
-rwxr-xr-xeditclassifications.cgi11
1 files changed, 7 insertions, 4 deletions
diff --git a/editclassifications.cgi b/editclassifications.cgi
index 1a1e48026..0e8ffde99 100755
--- a/editclassifications.cgi
+++ b/editclassifications.cgi
@@ -111,12 +111,15 @@ unless ($action) {
# - must use "group by classifications.id" instead of
# products.classification_id. Otherwise it won't look for all
# classification ids, just the ones used by the products.
- my $sth = $dbh->prepare("SELECT classifications.id,classifications.name,
+ my $sth = $dbh->prepare("SELECT classifications.id, classifications.name,
classifications.description,
- COUNT(classification_id) as total
+ COUNT(classification_id) AS total
FROM classifications
- LEFT JOIN products ON classifications.id=products.classification_id
- GROUP BY classifications.id
+ LEFT JOIN products
+ ON classifications.id = products.classification_id
+ " . $dbh->sql_group_by('classifications.id',
+ 'classifications.name,
+ classifications.description') . "
ORDER BY name");
$sth->execute();
while (my ($id,$classification,$description,$total) = $sth->fetchrow_array()) {