mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Fix count_rows with more than one group by column
This commit is contained in:
@@ -1292,7 +1292,7 @@ function count_rows($table, $where, $is_group, $group) {
|
||||
$query = " FROM " . table($table) . ($where ? " WHERE " . implode(" AND ", $where) : "");
|
||||
return ($is_group && ($jush == "sql" || count($group) == 1)
|
||||
? "SELECT COUNT(DISTINCT " . implode(", ", $group) . ")$query"
|
||||
: "SELECT COUNT(*)" . ($is_group ? " FROM (SELECT 1$query$group_by) x" : $query)
|
||||
: "SELECT COUNT(*)" . ($is_group ? " FROM (SELECT 1$query GROUP BY " . implode(", ", $group) . ") x" : $query)
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user