mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
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:
parent
94802d3518
commit
38ec3fb080
1 changed files with 2 additions and 3 deletions
|
@ -2486,9 +2486,8 @@ function forum_count_discussion_replies($forumid, $forumsort="", $limit=-1, $pag
|
||||||
FROM {forum_posts} p
|
FROM {forum_posts} p
|
||||||
JOIN {forum_discussions} d ON p.discussion = d.id
|
JOIN {forum_discussions} d ON p.discussion = d.id
|
||||||
WHERE d.forum = ?
|
WHERE d.forum = ?
|
||||||
GROUP BY p.discussion $groupby
|
GROUP BY p.discussion $groupby $orderby";
|
||||||
$orderby";
|
return $DB->get_records_sql($sql, array($forumid), $limitfrom, $limitnum);
|
||||||
return $DB->get_records_sql("SELECT * FROM ($sql) sq", array($forumid), $limitfrom, $limitnum);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue