From: Jakub Vrana Date: Thu, 1 Feb 2018 19:45:49 +0000 (+0100) Subject: Fix count_rows with more than one group by column X-Git-Tag: v4.6.0~13 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=09920e0056264ae1aebdcf01960bf42a2b2aa2ff;p=adminer.git Fix count_rows with more than one group by column --- diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 9f78c205..a92e7042 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -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) ); }