MDL-49216 mod_forum: Move subquery to outer component

It is not possible to order sub-query results with some RDBMs, and the
subquery is not necessary anyway.
This commit is contained in:
Andrew Nicols 2015-02-18 11:57:29 +08:00
parent 94802d3518
commit 38ec3fb080

View File

@ -2486,9 +2486,8 @@ function forum_count_discussion_replies($forumid, $forumsort="", $limit=-1, $pag
FROM {forum_posts} p
JOIN {forum_discussions} d ON p.discussion = d.id
WHERE d.forum = ?
GROUP BY p.discussion $groupby
$orderby";
return $DB->get_records_sql("SELECT * FROM ($sql) sq", array($forumid), $limitfrom, $limitnum);
GROUP BY p.discussion $groupby $orderby";
return $DB->get_records_sql($sql, array($forumid), $limitfrom, $limitnum);
}
}