From a46b21590d2ee40596cafb9bfaa045f4e33f49e7 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 18 Jan 2022 06:59:02 +0000 Subject: [PATCH] use "ANY_VALUE" instead of "MAX" --- src/Database/Database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index 292625bb57..cc7f754ee6 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -1377,7 +1377,7 @@ class Database private function escapeFields(array $fields, array $options) { // In the case of a "GROUP BY" we have to add all the ORDER fields to the fieldlist. - // This needs to done to apply the "MAX(...)" treatment from below to them. + // This needs to done to apply the "ANY_VALUE(...)" treatment from below to them. // Otherwise MySQL would report errors. if (!empty($options['group_by']) && !empty($options['order'])) { foreach ($options['order'] as $key => $field) { @@ -1399,7 +1399,7 @@ class Database $value = '`' . str_replace('`', '``', $value) . '`'; if (!empty($options['group_by']) && !in_array($field, $options['group_by'])) { - $value = 'MAX(' . $value . ') AS ' . $value; + $value = 'ANY_VALUE(' . $value . ') AS ' . $value; } });