Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
06e3b6d
)
MDL-58754 competency: Change query for DISTINCT COUNT
author
Andrew Nicols
<andrew@nicols.co.uk>
Tue, 2 May 2017 06:48:35 +0000
(14:48 +0800)
committer
Andrew Nicols
<andrew@nicols.co.uk>
Tue, 2 May 2017 06:48:35 +0000
(14:48 +0800)
competency/classes/competency.php
patch
|
blob
|
blame
|
history
diff --git
a/competency/classes/competency.php
b/competency/classes/competency.php
index
a38681c
..
c537508
100644
(file)
--- a/
competency/classes/competency.php
+++ b/
competency/classes/competency.php
@@
-676,7
+676,8
@@
class competency extends persistent {
public static function share_same_framework(array $ids) {
global $DB;
list($insql, $params) = $DB->get_in_or_equal($ids);
- return $DB->count_records_select(self::TABLE, "id $insql", $params, "COUNT(DISTINCT(competencyframeworkid))") == 1;
+ $sql = "SELECT COUNT('x') FROM (SELECT DISTINCT(competencyframeworkid) FROM {" . self::TABLE . "} WHERE id {$insql}) f";
+ return $DB->count_records_sql($sql, $params) == 1;
}
/**