-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
2.0.3, 2.1.10, 2.2.10, 2.3.7, 2.4, 2.5, 2.6
-
None
-
My test machine setup:
- Moodle version 2.0.3+ (Build: 20110609)
- MS SQL 2005
- Microsoft SQL Server Driver for PHP 2.0.1802.200
- Windows XP SP3
- IIS 5.1
- PHP 5.3.3 NTS (MSVC9 x86) running under MS FastCGI
- Microsoft Windows Cache Extension for PHP 1.1.630.0
Moodle config:
$CFG->dbtype = 'sqlsrv';
$CFG->dblibrary = 'native';
My test machine setup: - Moodle version 2.0.3+ (Build: 20110609) - MS SQL 2005 - Microsoft SQL Server Driver for PHP 2.0.1802.200 - Windows XP SP3 - IIS 5.1 - PHP 5.3.3 NTS (MSVC9 x86) running under MS FastCGI - Microsoft Windows Cache Extension for PHP 1.1.630.0 Moodle config: $CFG->dbtype = 'sqlsrv'; $CFG->dblibrary = 'native';
-
PostgreSQL, Microsoft SQL
-
-
N/A - running on localhost
-
MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
When I create a "Users Report" I get the following "ORDER BY items must appear in the select list if SELECT DISTINCT is specified" error. I've attached a documet with screenshots of the data that I captured on each of the Confirgurable Reports setup tabs. The Users Report doesn't have an option to manually edit the generated SQL so there is no way to proceed.
The error is:
sqlsrv_query: SQLSTATE = 42000 sqlsrv_query: error code = 145 sqlsrv_query: message = [Microsoft][SQL Server Native Client 10.0][SQL Server]ORDER BY items must appear in the select list if SELECT DISTINCT is specified. Default exception handler: Error reading from database Debug: SQLState: 42000
Error Code: 145
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
SELECT DISTINCT u.id, ra.roleid FROM mdl_role_assignments ra JOIN mdl_user u ON u.id = ra.userid JOIN mdl_role r ON ra.roleid = r.id WHERE (ra.contextid = '2' ) AND ra.roleid = '5' ORDER BY u.lastname, u.firstname [array ( 0 => '2', 1 => '5', )] * line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown * line 252 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end() * line 368 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end() * line 773 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query() * line 807 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->get_recordset_sql() * line 5253 of \lib\accesslib.php: call to sqlsrv_native_moodle_database->get_records_sql() * line 45 of \blocks\configurable_reports\components\conditions\usersincurrentcourse\plugin.class.php: call to get_role_users() * line 321 of \blocks\configurable_reports\report.class.php: call to plugin_usersincurrentcourse->execute() * line 358 of \blocks\configurable_reports\report.class.php: call to report_base->elements_by_conditions() * line 67 of \blocks\configurable_reports\viewreport.php: call to report_base->create_report()
- has a non-specific relationship to
-
MDL-29769 get_role_users generating "ORDER BY items must appear in the select list if SELECT DISTINCT is specified" errors
-
- Closed
-