MDL-25138 core_tag: fix correlated tags query unique error

This commit is contained in:
Simey Lameze
2015-05-13 10:25:11 +08:00
committed by David Monllao
parent f461827532
commit a236699367
+3 -2
View File
@@ -1384,10 +1384,11 @@ function tag_get_correlated($tag_id, $limitnum=null) {
}
// this is (and has to) return the same fields as the query in tag_get_tags
$sql = "SELECT DISTINCT tg.id, tg.tagtype, tg.name, tg.rawname, tg.flag, ti.ordering
$sql = "SELECT ti.id AS taginstanceid, tg.id, tg.tagtype, tg.name, tg.rawname, tg.flag, ti.ordering
FROM {tag} tg
INNER JOIN {tag_instance} ti ON tg.id = ti.tagid
WHERE tg.id IN ({$tag_correlation->correlatedtags})";
WHERE tg.id IN ({$tag_correlation->correlatedtags})
ORDER BY ti.ordering ASC";
$result = $DB->get_records_sql($sql);
if (!$result) {
return array();