diff --git a/libraries/classes/Sql.php b/libraries/classes/Sql.php index a3883fc5e9..991dd06599 100644 --- a/libraries/classes/Sql.php +++ b/libraries/classes/Sql.php @@ -701,7 +701,7 @@ class Sql $statement->limit = false; } - if (! $statementInfo->isGroup && count($statement->expr) === 1) { + if (! $statementInfo->isGroup && ! $statementInfo->distinct && count($statement->expr) === 1) { $statement->expr[0] = new Expression(); $statement->expr[0]->expr = '1'; }