MDL-66767 forumreport_summary: Improved groups only SQL
authorMichael Hawkins <michaelh@moodle.com>
Fri, 18 Oct 2019 04:35:53 +0000 (12:35 +0800)
committerMichael Hawkins <michaelh@moodle.com>
Fri, 18 Oct 2019 04:35:53 +0000 (12:35 +0800)
mod/forum/report/summary/classes/summary_table.php

index ac93572..0ac4d97 100644 (file)
@@ -333,13 +333,11 @@ class summary_table extends table_sql {
 
                         // No joins required (handled by where to prevent data duplication).
                         $this->sql->filterwhere .= "
-                            AND u.id = (
-                                 SELECT gm.userid
-                                   FROM {groups_members} gm
-                                  WHERE gm.userid = u.id
-                                    AND gm.groupid {$groupusersin}
-                               GROUP BY gm.userid
-                                  LIMIT 1)
+                            AND u.id IN (
+                                SELECT gm.userid
+                                  FROM {groups_members} gm
+                                 WHERE gm.groupid {$groupusersin}
+                            )
                             AND d.groupid {$groupidin}";
                         $this->sql->params += $groupusersparams + $groupidparams;
                     }