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 --- Bugzilla/DB/Mysql.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Bugzilla/DB') diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 33354cb44..7b2a7b2c2 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -143,6 +143,17 @@ sub sql_position { } } +sub sql_group_by { + my ($self, $needed_columns, $optional_columns) = @_; + + # MySQL allows to specify all columns as ANSI SQL requires, but also + # allow you to specify just minimal subset to get unique result. + # According to MySQL documentation, the less columns you specify + # the faster the query runs. + return "GROUP BY $needed_columns"; +} + + sub bz_lock_tables { my ($self, @tables) = @_; -- cgit v1.2.3-24-g4f1b