]> git.mjollnir.org Git - moodle.git/commitdiff
Fixing bug (Postgres related):
authorvyshane <vyshane>
Mon, 10 Apr 2006 05:59:48 +0000 (05:59 +0000)
committervyshane <vyshane>
Mon, 10 Apr 2006 05:59:48 +0000 (05:59 +0000)
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

mod/data/view.php

index fc0d45229e16ee09f316eea1fadebbbf816899e9..10ad143a1e0432cd3693b54be6a741ef0d93beb7 100755 (executable)
 
 /// Find the field we are sorting on
     if ($sort) {
+        
         $sortfield = data_get_field_from_id($sort, $data);
         $sortcontent = $sortfield->get_sort_field();
         $sortcontentfull = $sortfield->get_sort_sql('c.'.$sortcontent);
 
-        $what = ' DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname ';
+        $what = ' DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname, c.'.$sortcontent.' ';
         $count = ' COUNT(DISTINCT c.recordid) ';
         $tables = $CFG->prefix.'data_content c,'.$CFG->prefix.'data_records r,'.$CFG->prefix.'data_content c1, '.$CFG->prefix.'user u ';
         $where =  'WHERE c.recordid = r.id 
         $searchselect = ' AND (c.content LIKE "%'.$search.'%") ';
 
     } else {
-        $what = ' DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname ';
+        $what = ' DISTINCT r.id, r.approved, r.timecreated, r.userid, u.firstname, u.lastname ';
         $count = ' COUNT(r.id) ';
         $tables = $CFG->prefix.'data_records r, '.$CFG->prefix.'user u ';
         $where =  'WHERE r.dataid = '.$data->id. ' AND r.userid = u.id ';