diff --git a/report/stats/user.php b/report/stats/user.php index 25fbf0a6965..85841ea5357 100644 --- a/report/stats/user.php +++ b/report/stats/user.php @@ -127,7 +127,7 @@ $params = $param->params; $param->table = 'user_'.$param->table; -$sql = 'SELECT timeend,'.$param->fields.' FROM {stats_'.$param->table.'} WHERE ' +$sql = 'SELECT id, timeend,'.$param->fields.' FROM {stats_'.$param->table.'} WHERE ' .(($course->id == SITEID) ? '' : ' courseid = '.$course->id.' AND ') .' userid = '.$user->id.' AND timeend >= '.$param->timeafter .$param->extras .' ORDER BY timeend DESC';