mirror of
https://github.com/moodle/moodle.git
synced 2025-02-01 05:18:06 +01:00
MDL-26371 sql - avoid distinct + text in glossary search
This commit is contained in:
parent
f320cb76c3
commit
b37d06c2ed
@ -134,6 +134,9 @@
|
||||
default:
|
||||
$sqlselect = "SELECT ge.*, ge.concept AS glossarypivot";
|
||||
$sqlfrom = "FROM {glossary_entries} ge";
|
||||
// For cases needing inner view
|
||||
$sqlwrapheader = '';
|
||||
$sqlwrapfooter = '';
|
||||
|
||||
$where = '';
|
||||
$fullpivot = 0;
|
||||
@ -203,7 +206,13 @@
|
||||
} else {
|
||||
$searchcond = implode(" AND ", $searchcond);
|
||||
|
||||
$sqlselect = "SELECT DISTINCT ge.*, ge.concept AS glossarypivot";
|
||||
// Need one inner view here to avoid distinct + text
|
||||
$sqlwrapheader = 'SELECT ge.*, ge.concept AS glossarypivot
|
||||
FROM {glossary_entries} ge
|
||||
JOIN ( ';
|
||||
$sqlwrapfooter = ' ) gei ON (ge.id = gei.id)';
|
||||
|
||||
$sqlselect = "SELECT DISTINCT ge.id";
|
||||
$sqlfrom = "FROM {glossary_entries} ge
|
||||
LEFT JOIN {glossary_alias} al ON al.entryid = ge.id";
|
||||
$where = "AND ($searchcond)";
|
||||
@ -262,5 +271,6 @@
|
||||
$limitnum = $entriesbypage;
|
||||
}
|
||||
|
||||
$allentries = $DB->get_records_sql("$sqlselect $sqlfrom $sqlwhere $sqlorderby", $params, $limitfrom, $limitnum);
|
||||
$query = "$sqlwrapheader $sqlselect $sqlfrom $sqlwhere $sqlwrapfooter $sqlorderby";
|
||||
$allentries = $DB->get_records_sql($query, $params, $limitfrom, $limitnum);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user