Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3204

"Error reading from database" when creating a Users Report under MSSQL 2005

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • 2.0.3, 2.1.10, 2.2.10, 2.3.7, 2.4, 2.5, 2.6
    • None
    • PostgreSQL, Microsoft SQL
    • Hide

      None...

      Show
      None...
    • 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()

            moodle.com Moodle HQ
            libertymoodle Luis de Vasconcelos
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.