Merging latest changes from stable branch up to 2.3.24
[fa-stable.git] / includes / db_pager.inc
index f9089e9ee5a0f2ba89f152762f0645f5dab020ad..b9e7e75927445b30fc45140cc9bbe72119a542ca 100644 (file)
@@ -303,7 +303,7 @@ class db_pager {
                if ($count) {
                        $group = $group == '' ? "*" : "DISTINCT $group";
 
-                       return "SELECT COUNT($group) FROM $from $where";
+                       return "SELECT COUNT(*) FROM (SELECT $group FROM $from $where) tmp_count";
                }
 
                $sql = "$select FROM $from $where";