Permalink
Browse files

Fixed incorrect DISTINCT applied over TEXT field

Causes SQL query to not work on SQL Server
  • Loading branch information...
1 parent e3109b9 commit 2a578bffdc5579b3d61a06fd1163949daa064e0f @jleyva committed Aug 9, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 components/filters/fuserfield/plugin.class.php
View
4 components/filters/fuserfield/plugin.class.php
@@ -104,7 +104,7 @@ function print_filter(&$mform, $data){
$selectname = $field->name;
list($usql, $params) = $DB->get_in_or_equal($userlist);
- $sql = "SELECT DISTINCT(data) as data FROM {user_info_data} WHERE fieldid = ? AND userid $usql";
+ $sql = "SELECT data FROM {user_info_data} WHERE fieldid = ? AND userid $usql";
$params = array_merge(array($field->id),$params);
if($infodata = $DB->get_records_sql($sql,$params)){
@@ -119,7 +119,7 @@ function print_filter(&$mform, $data){
$selectname = get_string($data->field);
list($usql, $params) = $DB->get_in_or_equal($userlist);
- $sql = "SELECT DISTINCT(".$data->field.") as ufield FROM {user} WHERE id $usql ORDER BY ufield ASC";
+ $sql = "SELECT ".$data->field." as ufield FROM {user} WHERE id $usql ORDER BY ufield ASC";
if($rs = $DB->get_recordset_sql($sql, $params)){
foreach($rs as $u){
$filteroptions[base64_encode($u->ufield)] = $u->ufield;

0 comments on commit 2a578bf

Please sign in to comment.