use "ANY_VALUE" instead of "MAX"
This commit is contained in:
parent
615c6ca696
commit
a46b21590d
1 changed files with 2 additions and 2 deletions
|
@ -1377,7 +1377,7 @@ class Database
|
||||||
private function escapeFields(array $fields, array $options)
|
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.
|
// 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.
|
// Otherwise MySQL would report errors.
|
||||||
if (!empty($options['group_by']) && !empty($options['order'])) {
|
if (!empty($options['group_by']) && !empty($options['order'])) {
|
||||||
foreach ($options['order'] as $key => $field) {
|
foreach ($options['order'] as $key => $field) {
|
||||||
|
@ -1399,7 +1399,7 @@ class Database
|
||||||
$value = '`' . str_replace('`', '``', $value) . '`';
|
$value = '`' . str_replace('`', '``', $value) . '`';
|
||||||
|
|
||||||
if (!empty($options['group_by']) && !in_array($field, $options['group_by'])) {
|
if (!empty($options['group_by']) && !in_array($field, $options['group_by'])) {
|
||||||
$value = 'MAX(' . $value . ') AS ' . $value;
|
$value = 'ANY_VALUE(' . $value . ') AS ' . $value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue