Mysqli_query failed in suitecrm.log

I am stuck trying to solve this error. It occurs when I try to export data from a custom module. Any pointers?

Wed Jan 3 19:02:18 2024 [3379319][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Mysqli_query failed.

Wed Jan 3 19:02:18 2024 [3379319][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Error exporting mg_st_student:
. SELECT mg_st_student.*

Wed Jan 3 19:02:18 2024 [3379319][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Exception handling in /home/ka6gg94cwdel/public_html/include/MVC/Controller/SugarController.php:397

Wed Jan 3 19:02:18 2024 [3379319][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.

  1. Version of Suite?
    Version PHP?
    Version mariadb or mysql?

  2. Look at suitecrm.log file located in your SuiteCRM base directory (usually /home/ka6gg94cwdel/public_html/suitecrm.log ). Look for log entries around the day and time of the error. Post them back here.

SuiteCRM v 7.12.7
PHP version: 8.1.16
10.5.23-MariaDB-log

The error messages from suitecrm.log are in the OP.

The messages shown are not complete. Those failed SQL queries are probably reported, in full, in the logs, and they would be interesting to know. Thanks

Above SQL query is not complete. Please share SQL queries which are located in /suitecrm.log file.

Hello, I have repeated the action and copied below everything in the log file from today:

Mon Jan 15 15:50:47 2024 [1965299][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Mysqli_query failed.
Mon Jan 15 15:50:47 2024 [1965299][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Error exporting mg_st_student:
. SELECT mg_st_student.* ,mg_st_student_cstm.passport_expiry_date_c,mg_st_student_cstm.pm_c,mg_st_student_cstm.visa_application_status_c,mg_st_student_cstm.mg_mo_modules_id7_c,mg_st_student_cstm.debt_amount_c,mg_st_student_cstm.date_arrived_late_c,mg_st_student_cstm.source_of_application_c,mg_st_student_cstm.module_4_name_c,mg_st_student_cstm.acase_id_c,mg_st_student_cstm.parent_type,mg_st_student_cstm.module_6_code_c,mg_st_student_cstm.previous_am_c,mg_st_student_cstm.module_5_code_c,mg_st_student_cstm.student_meeting_notes_c,mg_st_student_cstm.parent_id,mg_st_student_cstm.permission_academic_agent_c,mg_st_student_cstm.programmetype_c,mg_st_student_cstm.module_6_name_c,mg_st_student_cstm.passport_place_of_birth_c,mg_st_student_cstm.personal_tutor_menu_c,mg_st_student_cstm.passport_notes_c,mg_st_student_cstm.cas_created_date_c,mg_st_student_cstm.cas_status_c,mg_st_student_cstm.module__5_name_c,mg_st_student_cstm.age_at_course_start_c,mg_st_student_cstm.visa_checked_c,mg_st_student_cstm.current_study_location_c,mg_st_student_cstm.welfare_notes_text_area_c,mg_st_student_cstm.reason_for_leaving_notes_c,mg_st_student_cstm.pt_pt_notes_id_c,mg_st_student_cstm.term_time_address_monitoring_c,mg_st_student_cstm.sen_notes_c,mg_st_student_cstm.term_time_address_3_c,mg_st_student_cstm.pt_notes_text_area_c,mg_st_student_cstm.module_1_iteration_c,mg_st_student_cstm.module_7_iteration_c,mg_st_student_cstm.english_qualification_notes_c,mg_st_student_cstm.meeting_notes_text_area_c,mg_st_student_cstm.module_1_code_c,mg_st_student_cstm.uosfaculty_c,mg_st_student_cstm.country_of_residence_c,mg_st_student_cstm.programme_manager_c,mg_st_student_cstm.accommodation_allocated_c,mg_st_student_cstm.regional_manager_email_c,mg_st_student_cstm.final_university_degree_c,mg_st_student_cstm.academicyear_c,mg_st_student_cstm.module_8_iteration_c,mg_st_student_cstm.module_3_code_c,mg_st_student_cstm.module_8_name_c,mg_st_student_cstm.permission_welfare_sponsor_c,mg_st_student_cstm.year_of_exit_uos_c,mg_st_student_cstm.degree_outcome_c,mg_st_student_cstm.academic_awarding_body_c,mg_st_student_cstm.last_educational_institution_c,mg_st_student_cstm.permission_attendance_pg_c,mg_st_student_cstm.module_1_name_c,mg_st_student_cstm.academic_qualification_date_c,mg_st_student_cstm.module_8_code_c,mg_st_student_cstm.mg_mo_modules_id12_c,mg_st_student_cstm.permission_attendance_agent_c,mg_st_student_cstm.award_name_uos_c,mg_st_student_cstm.course_name_c,mg_st_student_cstm.cas_evidence_c,mg_st_student_cstm.sits_id_c,mg_st_student_cstm.reg_form_completed_c,mg_st_student_cstm.non_submission_c,mg_st_student_cstm.personal_tutor_c,mg_st_student_cstm.permitted_to_attend_class_c,mg_st_student_cstm.sponsored_c,mg_st_student_cstm.last_response_c,mg_st_student_cstm.age_c,mg_st_student_cstm.module_7_code_c,mg_st_student_cstm.crs_code_c,mg_st_student_cstm.address_status_c,mg_st_student_cstm.mtg_meeting_notes_id_c,mg_st_student_cstm.agent_name_c,mg_st_student_cstm.next_ofkin_name_c,mg_st_student_cstm.permission_progression_pg_c,mg_st_student_cstm.disability_disclosed_c,mg_st_student_cstm.visa_notes_c,mg_st_student_cstm.academic_qualification_overa_c,mg_st_student_cstm.progressor_type_c,mg_st_student_cstm.greater_region_c,mg_st_student_cstm.behaviour_disciplinary_c,mg_st_student_cstm.at_risk_action_plan_c,mg_st_student_cstm.regional_manager_c,mg_st_student_cstm.module_7_name_c,mg_st_student_cstm.permission_enrolment_pg_c,mg_st_student_cstm.module_4_iteration_c,mg_st_student_cstm.student_category_c,mg_st_student_cstm.english_qual_is_selt_c,mg_st_student_cstm.module_4_code_c,mg_st_student_cstm.passport_number_c,mg_st_student_cstm.module_2_name_c,mg_st_student_cstm.at_risk_reason_multi_c,mg_st_student_cstm.module_5_iteration_c,mg_st_student_cstm.destination_university_c,mg_st_student_cstm.passport_place_of_issue_c,mg_st_student_cstm.aruaa_notes_c,mg_st_student_cstm.module_3_iteration_c,mg_st_student_cstm.academic_qualification_name_c,mg_st_student_cstm.attendance_warning_stage_c,mg_st_student_cstm.current_student_status_c,mg_st_student_cstm.agent_type_c,mg_st_student_cstm.module_3_name_c,mg_st_student_cstm.country_of_birth_c,mg_st_student_cstm.module_2_iteration_c,mg_st_student_cstm.mg_mo_aruaa_id_c,mg_st_student_cstm.selfcerts_c,mg_st_student_cstm.permission_academic_pg_c,mg_st_student_cstm.registration_date_c,mg_st_student_cstm.permission_welfare_pg_c,mg_st_student_cstm.known_as_c,mg_st_student_cstm.into_pay_link_c,mg_st_student_cstm.course_type_c,mg_st_student_cstm.next_of_kin_relationship_c,mg_st_student_cstm.term_time_address_2_c,mg_st_student_cstm.late_arriver_for_course_c,mg_st_student_cstm.module_2_code_c,mg_st_student_cstm.photo_c,mg_st_student_cstm.academic_qualification_notes_c,mg_st_student_cstm.permission_welfare_agent_c,mg_st_student_cstm.onboarding_status_c,mg_st_student_cstm.mg_mo_modules_id6_c,mg_st_student_cstm.award_classification_uos_c,mg_st_student_cstm.degreemajor_c,mg_st_student_cstm.integrated_course_c,mg_st_student_cstm.mg_mo_welfarenotes_id_c,mg_st_student_cstm.on_track_c,mg_st_student_cstm.agent_urn_c,mg_st_student_cstm.intake_month_c,mg_st_student_cstm.module_6_iteration_c,mg_st_student_cstm.action_plan_c,mg_st_student_cstm.at_risk_reason_c,mg_st_student_cstm.passport_issue_date_c,mg_st_student_cstm.term_time_region_c,mg_st_student_cstm.cas_number_c , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , ‘Users’ modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , ‘Users’ created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, jt3.name module_1 , jt4.name module_2 , jt5.name module_3 , jt6.name module_4 , jt7.name module5 , jt8.name module6 , jt9.name mg_mo_aruaa_mg_st_student_name, jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida , jt10.name mg_mo_welfarenotes_mg_st_student_1_name, jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida, jt11.name module_7_c , jt12.name pt_notes_c , jt13.name welfare_notes_c , LTRIM(RTRIM(CONCAT(IFNULL(jt14.document_name,‘’)))) meeting_notes_c , jt15.name pt_module_c , jt16.name module_8_c , jt17.name aruaa_c , jt18.name cases_c FROM mg_st_student LEFT JOIN mg_st_student_cstm ON mg_st_student.id = mg_st_student_cstm.id_c LEFT JOIN users jt0 ON mg_st_student.modified_user_id=jt0.id AND jt0.deleted=0

AND jt0.deleted=0 LEFT JOIN users jt1 ON mg_st_student.created_by=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 LEFT JOIN users jt2 ON mg_st_student.assigned_user_id=jt2.id AND jt2.deleted=0

AND jt2.deleted=0 LEFT JOIN mg_mo_modules jt3 ON mg_st_student.mg_mo_modules_id_c = jt3.id AND jt3.deleted=0 LEFT JOIN mg_mo_modules jt4 ON mg_st_student.mg_mo_modules_id1_c = jt4.id AND jt4.deleted=0 LEFT JOIN mg_mo_modules jt5 ON mg_st_student.mg_mo_modules_id2_c = jt5.id AND jt5.deleted=0 LEFT JOIN mg_mo_modules jt6 ON mg_st_student.mg_mo_modules_id3_c = jt6.id AND jt6.deleted=0 LEFT JOIN mg_mo_modules jt7 ON mg_st_student.mg_mo_modules_id4_c = jt7.id AND jt7.deleted=0 LEFT JOIN mg_mo_modules jt8 ON mg_st_student.mg_mo_modules_id5_c = jt8.id AND jt8.deleted=0 LEFT JOIN mg_mo_aruaa_mg_st_student_c jtl9 ON mg_st_student.id=jtl9.mg_mo_aruaa_mg_st_studentmg_st_student_idb AND jtl9.deleted=0

LEFT JOIN mg_mo_aruaa jt9 ON jt9.id=jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida AND jt9.deleted=0
AND jt9.deleted=0 LEFT JOIN mg_mo_welfarenotes_mg_st_student_1_c jtl10 ON mg_st_student.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_st_student_idb AND jtl10.deleted=0

LEFT JOIN mg_mo_welfarenotes jt10 ON jt10.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida AND jt10.deleted=0
AND jt10.deleted=0 LEFT JOIN mg_mo_modules jt11 ON mg_st_student_cstm.mg_mo_modules_id6_c = jt11.id AND jt11.deleted=0 LEFT JOIN pt_pt_notes jt12 ON mg_st_student_cstm.pt_pt_notes_id_c = jt12.id AND jt12.deleted=0 LEFT JOIN mg_mo_welfarenotes jt13 ON mg_st_student_cstm.mg_mo_welfarenotes_id_c = jt13.id AND jt13.deleted=0 LEFT JOIN mtg_meeting_notes jt14 ON mg_st_student_cstm.mtg_meeting_notes_id_c = jt14.id AND jt14.deleted=0 LEFT JOIN mg_mo_modules jt15 ON mg_st_student_cstm.mg_mo_modules_id12_c = jt15.id AND jt15.deleted=0 LEFT JOIN mg_mo_modules jt16 ON mg_st_student_cstm.mg_mo_modules_id7_c = jt16.id AND jt16.deleted=0 LEFT JOIN mg_mo_aruaa jt17 ON mg_st_student_cstm.mg_mo_aruaa_id_c = jt17.id AND jt17.deleted=0 LEFT JOIN mg_st_student jt18 ON mg_st_student_cstm. = jt18.id AND jt18.deleted=0 where (mg_st_student.id in (‘IN58E3068778Q’,‘IN58A7933982Q’,‘IN58A7869775Q’,‘IN58A7998223Q’,‘IN58E2878139Q’,‘IN58A7957685Q’,‘IN58E2889219Q’,‘IN58A7957473Q’,‘IN58E2863832Q’,‘IN58A7928967Q’,‘IN58A7953775Q’,‘IN58A7951090Q’,‘IN58A8001044Q’,‘IN58A8006348Q’,‘IN58A8017043Q’,‘IN58A8042459Q’,‘IN58A7892945Q’,‘IN58A8022452Q’,‘IN58E3051159Q’,‘IN58A7984472Q’,‘IN58A7949163Q’,‘IN58A7984661Q’,‘IN58E3010856Q’,‘IN58A8026039Q’,‘IN58E3005532Q’,‘IN58A7991026Q’,‘IN58E2974816Q’,‘IN58A7926512Q’,‘IN58A7966819Q’,‘IN58A8001418Q’,‘IN58E2985717Q’,‘IN58E3056855Q’,‘IN58E2836720Q’,‘IN58E3026915Q’,‘IN58E2967421Q’,‘IN58E2975008Q’,‘IN58A7963419Q’,‘IN58E3102543Q’,‘IN58E2980859Q’,‘IN58A8021419Q’,‘IN58A8031145Q’,‘IN58A8023233Q’,‘IN58E2809335Q’,‘IN58E3104359Q’,‘IN58E3052908Q’,‘IN58A7930173Q’,‘IN58A7971527Q’,‘IN58A7969483Q’,‘IN58E2980512Q’,‘IN58A7999412Q’)) AND mg_st_student.deleted=0 Query Failed: SELECT mg_st_student.* ,mg_st_student_cstm.passport_expiry_date_c,mg_st_student_cstm.pm_c,mg_st_student_cstm.visa_application_status_c,mg_st_student_cstm.mg_mo_modules_id7_c,mg_st_student_cstm.debt_amount_c,mg_st_student_cstm.date_arrived_late_c,mg_st_student_cstm.source_of_application_c,mg_st_student_cstm.module_4_name_c,mg_st_student_cstm.acase_id_c,mg_st_student_cstm.parent_type,mg_st_student_cstm.module_6_code_c,mg_st_student_cstm.previous_am_c,mg_st_student_cstm.module_5_code_c,mg_st_student_cstm.student_meeting_notes_c,mg_st_student_cstm.parent_id,mg_st_student_cstm.permission_academic_agent_c,mg_st_student_cstm.programmetype_c,mg_st_student_cstm.module_6_name_c,mg_st_student_cstm.passport_place_of_birth_c,mg_st_student_cstm.personal_tutor_menu_c,mg_st_student_cstm.passport_notes_c,mg_st_student_cstm.cas_created_date_c,mg_st_student_cstm.cas_status_c,mg_st_student_cstm.module__5_name_c,mg_st_student_cstm.age_at_course_start_c,mg_st_student_cstm.visa_checked_c,mg_st_student_cstm.current_study_location_c,mg_st_student_cstm.welfare_notes_text_area_c,mg_st_student_cstm.reason_for_leaving_notes_c,mg_st_student_cstm.pt_pt_notes_id_c,mg_st_student_cstm.term_time_address_monitoring_c,mg_st_student_cstm.sen_notes_c,mg_st_student_cstm.term_time_address_3_c,mg_st_student_cstm.pt_notes_text_area_c,mg_st_student_cstm.module_1_iteration_c,mg_st_student_cstm.module_7_iteration_c,mg_st_student_cstm.english_qualification_notes_c,mg_st_student_cstm.meeting_notes_text_area_c,mg_st_student_cstm.module_1_code_c,mg_st_student_cstm.uosfaculty_c,mg_st_student_cstm.country_of_residence_c,mg_st_student_cstm.programme_manager_c,mg_st_student_cstm.accommodation_allocated_c,mg_st_student_cstm.regional_manager_email_c,mg_st_student_cstm.final_university_degree_c,mg_st_student_cstm.academicyear_c,mg_st_student_cstm.module_8_iteration_c,mg_st_student_cstm.module_3_code_c,mg_st_student_cstm.module_8_name_c,mg_st_student_cstm.permission_welfare_sponsor_c,mg_st_student_cstm.year_of_exit_uos_c,mg_st_student_cstm.degree_outcome_c,mg_st_student_cstm.academic_awarding_body_c,mg_st_student_cstm.last_educational_institution_c,mg_st_student_cstm.permission_attendance_pg_c,mg_st_student_cstm.module_1_name_c,mg_st_student_cstm.academic_qualification_date_c,mg_st_student_cstm.module_8_code_c,mg_st_student_cstm.mg_mo_modules_id12_c,mg_st_student_cstm.permission_attendance_agent_c,mg_st_student_cstm.award_name_uos_c,mg_st_student_cstm.course_name_c,mg_st_student_cstm.cas_evidence_c,mg_st_student_cstm.sits_id_c,mg_st_student_cstm.reg_form_completed_c,mg_st_student_cstm.non_submission_c,mg_st_student_cstm.personal_tutor_c,mg_st_student_cstm.permitted_to_attend_class_c,mg_st_student_cstm.sponsored_c,mg_st_student_cstm.last_response_c,mg_st_student_cstm.age_c,mg_st_student_cstm.module_7_code_c,mg_st_student_cstm.crs_code_c,mg_st_student_cstm.address_status_c,mg_st_student_cstm.mtg_meeting_notes_id_c,mg_st_student_cstm.agent_name_c,mg_st_student_cstm.next_ofkin_name_c,mg_st_student_cstm.permission_progression_pg_c,mg_st_student_cstm.disability_disclosed_c,mg_st_student_cstm.visa_notes_c,mg_st_student_cstm.academic_qualification_overa_c,mg_st_student_cstm.progressor_type_c,mg_st_student_cstm.greater_region_c,mg_st_student_cstm.behaviour_disciplinary_c,mg_st_student_cstm.at_risk_action_plan_c,mg_st_student_cstm.regional_manager_c,mg_st_student_cstm.module_7_name_c,mg_st_student_cstm.permission_enrolment_pg_c,mg_st_student_cstm.module_4_iteration_c,mg_st_student_cstm.student_category_c,mg_st_student_cstm.english_qual_is_selt_c,mg_st_student_cstm.module_4_code_c,mg_st_student_cstm.passport_number_c,mg_st_student_cstm.module_2_name_c,mg_st_student_cstm.at_risk_reason_multi_c,mg_st_student_cstm.module_5_iteration_c,mg_st_student_cstm.destination_university_c,mg_st_student_cstm.passport_place_of_issue_c,mg_st_student_cstm.aruaa_notes_c,mg_st_student_cstm.module_3_iteration_c,mg_st_student_cstm.academic_qualification_name_c,mg_st_student_cstm.attendance_warning_stage_c,mg_st_student_cstm.current_student_status_c,mg_st_student_cstm.agent_type_c,mg_st_student_cstm.module_3_name_c,mg_st_student_cstm.country_of_birth_c,mg_st_student_cstm.module_2_iteration_c,mg_st_student_cstm.mg_mo_aruaa_id_c,mg_st_student_cstm.selfcerts_c,mg_st_student_cstm.permission_academic_pg_c,mg_st_student_cstm.registration_date_c,mg_st_student_cstm.permission_welfare_pg_c,mg_st_student_cstm.known_as_c,mg_st_student_cstm.into_pay_link_c,mg_st_student_cstm.course_type_c,mg_st_student_cstm.next_of_kin_relationship_c,mg_st_student_cstm.term_time_address_2_c,mg_st_student_cstm.late_arriver_for_course_c,mg_st_student_cstm.module_2_code_c,mg_st_student_cstm.photo_c,mg_st_student_cstm.academic_qualification_notes_c,mg_st_student_cstm.permission_welfare_agent_c,mg_st_student_cstm.onboarding_status_c,mg_st_student_cstm.mg_mo_modules_id6_c,mg_st_student_cstm.award_classification_uos_c,mg_st_student_cstm.degreemajor_c,mg_st_student_cstm.integrated_course_c,mg_st_student_cstm.mg_mo_welfarenotes_id_c,mg_st_student_cstm.on_track_c,mg_st_student_cstm.agent_urn_c,mg_st_student_cstm.intake_month_c,mg_st_student_cstm.module_6_iteration_c,mg_st_student_cstm.action_plan_c,mg_st_student_cstm.at_risk_reason_c,mg_st_student_cstm.passport_issue_date_c,mg_st_student_cstm.term_time_region_c,mg_st_student_cstm.cas_number_c , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , ‘Users’ modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , ‘Users’ created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, jt3.name module_1 , jt4.name module_2 , jt5.name module_3 , jt6.name module_4 , jt7.name module5 , jt8.name module6 , jt9.name mg_mo_aruaa_mg_st_student_name, jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida , jt10.name mg_mo_welfarenotes_mg_st_student_1_name, jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida, jt11.name module_7_c , jt12.name pt_notes_c , jt13.name welfare_notes_c , LTRIM(RTRIM(CONCAT(IFNULL(jt14.document_name,‘’)))) meeting_notes_c , jt15.name pt_module_c , jt16.name module_8_c , jt17.name aruaa_c , jt18.name cases_c FROM mg_st_student LEFT JOIN mg_st_student_cstm ON mg_st_student.id = mg_st_student_cstm.id_c LEFT JOIN users jt0 ON mg_st_student.modified_user_id=jt0.id AND jt0.deleted=0

AND jt0.deleted=0 LEFT JOIN users jt1 ON mg_st_student.created_by=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 LEFT JOIN users jt2 ON mg_st_student.assigned_user_id=jt2.id AND jt2.deleted=0

AND jt2.deleted=0 LEFT JOIN mg_mo_modules jt3 ON mg_st_student.mg_mo_modules_id_c = jt3.id AND jt3.deleted=0 LEFT JOIN mg_mo_modules jt4 ON mg_st_student.mg_mo_modules_id1_c = jt4.id AND jt4.deleted=0 LEFT JOIN mg_mo_modules jt5 ON mg_st_student.mg_mo_modules_id2_c = jt5.id AND jt5.deleted=0 LEFT JOIN mg_mo_modules jt6 ON mg_st_student.mg_mo_modules_id3_c = jt6.id AND jt6.deleted=0 LEFT JOIN mg_mo_modules jt7 ON mg_st_student.mg_mo_modules_id4_c = jt7.id AND jt7.deleted=0 LEFT JOIN mg_mo_modules jt8 ON mg_st_student.mg_mo_modules_id5_c = jt8.id AND jt8.deleted=0 LEFT JOIN mg_mo_aruaa_mg_st_student_c jtl9 ON mg_st_student.id=jtl9.mg_mo_aruaa_mg_st_studentmg_st_student_idb AND jtl9.deleted=0

LEFT JOIN mg_mo_aruaa jt9 ON jt9.id=jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida AND jt9.deleted=0
AND jt9.deleted=0 LEFT JOIN mg_mo_welfarenotes_mg_st_student_1_c jtl10 ON mg_st_student.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_st_student_idb AND jtl10.deleted=0

LEFT JOIN mg_mo_welfarenotes jt10 ON jt10.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida AND jt10.deleted=0
AND jt10.deleted=0 LEFT JOIN mg_mo_modules jt11 ON mg_st_student_cstm.mg_mo_modules_id6_c = jt11.id AND jt11.deleted=0 LEFT JOIN pt_pt_notes jt12 ON mg_st_student_cstm.pt_pt_notes_id_c = jt12.id AND jt12.deleted=0 LEFT JOIN mg_mo_welfarenotes jt13 ON mg_st_student_cstm.mg_mo_welfarenotes_id_c = jt13.id AND jt13.deleted=0 LEFT JOIN mtg_meeting_notes jt14 ON mg_st_student_cstm.mtg_meeting_notes_id_c = jt14.id AND jt14.deleted=0 LEFT JOIN mg_mo_modules jt15 ON mg_st_student_cstm.mg_mo_modules_id12_c = jt15.id AND jt15.deleted=0 LEFT JOIN mg_mo_modules jt16 ON mg_st_student_cstm.mg_mo_modules_id7_c = jt16.id AND jt16.deleted=0 LEFT JOIN mg_mo_aruaa jt17 ON mg_st_student_cstm.mg_mo_aruaa_id_c = jt17.id AND jt17.deleted=0 LEFT JOIN mg_st_student jt18 ON mg_st_student_cstm. = jt18.id AND jt18.deleted=0 where (mg_st_student.id in (‘IN58E3068778Q’,‘IN58A7933982Q’,‘IN58A7869775Q’,‘IN58A7998223Q’,‘IN58E2878139Q’,‘IN58A7957685Q’,‘IN58E2889219Q’,‘IN58A7957473Q’,‘IN58E2863832Q’,‘IN58A7928967Q’,‘IN58A7953775Q’,‘IN58A7951090Q’,‘IN58A8001044Q’,‘IN58A8006348Q’,‘IN58A8017043Q’,‘IN58A8042459Q’,‘IN58A7892945Q’,‘IN58A8022452Q’,‘IN58E3051159Q’,‘IN58A7984472Q’,‘IN58A7949163Q’,‘IN58A7984661Q’,‘IN58E3010856Q’,‘IN58A8026039Q’,‘IN58E3005532Q’,‘IN58A7991026Q’,‘IN58E2974816Q’,‘IN58A7926512Q’,‘IN58A7966819Q’,‘IN58A8001418Q’,‘IN58E2985717Q’,‘IN58E3056855Q’,‘IN58E2836720Q’,‘IN58E3026915Q’,‘IN58E2967421Q’,‘IN58E2975008Q’,‘IN58A7963419Q’,‘IN58E3102543Q’,‘IN58E2980859Q’,‘IN58A8021419Q’,‘IN58A8031145Q’,‘IN58A8023233Q’,‘IN58E2809335Q’,‘IN58E3104359Q’,‘IN58E3052908Q’,‘IN58A7930173Q’,‘IN58A7971527Q’,‘IN58A7969483Q’,‘IN58E2980512Q’,‘IN58A7999412Q’)) AND mg_st_student.deleted=0: MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= jt18.id AND jt18.deleted=0 where (mg_st_student.id in (‘IN58E3068778Q’,‘IN…’ at line 13
Mon Jan 15 15:50:47 2024 [1965299][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Exception handling in /home/ka6gg94cwdel/public_html/include/MVC/Controller/SugarController.php:397
Mon Jan 15 15:50:47 2024 [1965299][d199061a-6622-c241-6568-5e56c42a5ecb][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.

Maybe there’s some SuiteCRM bug, but I wouldn’t be surprised if your database isn’t simply falling apart under the weight of that terrible data design. So many join tables, so many fields, the query is colossal, and that’s just not the way you’re supposed to use a relational database…

Yeah this is a huge query!

SELECT mg_st_student.* ,mg_st_student_cstm.passport_expiry_date_c,mg_st_student_cstm.pm_c,mg_st_student_cstm.visa_application_status_c,mg_st_student_cstm.mg_mo_modules_id7_c,mg_st_student_cstm.debt_amount_c,mg_st_student_cstm.date_arrived_late_c,mg_st_student_cstm.source_of_application_c,mg_st_student_cstm.module_4_name_c,mg_st_student_cstm.acase_id_c,mg_st_student_cstm.parent_type,mg_st_student_cstm.module_6_code_c,mg_st_student_cstm.previous_am_c,mg_st_student_cstm.module_5_code_c,mg_st_student_cstm.student_meeting_notes_c,mg_st_student_cstm.parent_id,mg_st_student_cstm.permission_academic_agent_c,mg_st_student_cstm.programmetype_c,mg_st_student_cstm.module_6_name_c,mg_st_student_cstm.passport_place_of_birth_c,mg_st_student_cstm.personal_tutor_menu_c,mg_st_student_cstm.passport_notes_c,mg_st_student_cstm.cas_created_date_c,mg_st_student_cstm.cas_status_c,mg_st_student_cstm.module__5_name_c,mg_st_student_cstm.age_at_course_start_c,mg_st_student_cstm.visa_checked_c,mg_st_student_cstm.current_study_location_c,mg_st_student_cstm.welfare_notes_text_area_c,mg_st_student_cstm.reason_for_leaving_notes_c,mg_st_student_cstm.pt_pt_notes_id_c,mg_st_student_cstm.term_time_address_monitoring_c,mg_st_student_cstm.sen_notes_c,mg_st_student_cstm.term_time_address_3_c,mg_st_student_cstm.pt_notes_text_area_c,mg_st_student_cstm.module_1_iteration_c,mg_st_student_cstm.module_7_iteration_c,mg_st_student_cstm.english_qualification_notes_c,mg_st_student_cstm.meeting_notes_text_area_c,mg_st_student_cstm.module_1_code_c,mg_st_student_cstm.uosfaculty_c,mg_st_student_cstm.country_of_residence_c,mg_st_student_cstm.programme_manager_c,mg_st_student_cstm.accommodation_allocated_c,mg_st_student_cstm.regional_manager_email_c,mg_st_student_cstm.final_university_degree_c,mg_st_student_cstm.academicyear_c,mg_st_student_cstm.module_8_iteration_c,mg_st_student_cstm.module_3_code_c,mg_st_student_cstm.module_8_name_c,mg_st_student_cstm.permission_welfare_sponsor_c,mg_st_student_cstm.year_of_exit_uos_c,mg_st_student_cstm.degree_outcome_c,mg_st_student_cstm.academic_awarding_body_c,mg_st_student_cstm.last_educational_institution_c,mg_st_student_cstm.permission_attendance_pg_c,mg_st_student_cstm.module_1_name_c,mg_st_student_cstm.academic_qualification_date_c,mg_st_student_cstm.module_8_code_c,mg_st_student_cstm.mg_mo_modules_id12_c,mg_st_student_cstm.permission_attendance_agent_c,mg_st_student_cstm.award_name_uos_c,mg_st_student_cstm.course_name_c,mg_st_student_cstm.cas_evidence_c,mg_st_student_cstm.sits_id_c,mg_st_student_cstm.reg_form_completed_c,mg_st_student_cstm.non_submission_c,mg_st_student_cstm.personal_tutor_c,mg_st_student_cstm.permitted_to_attend_class_c,mg_st_student_cstm.sponsored_c,mg_st_student_cstm.last_response_c,mg_st_student_cstm.age_c,mg_st_student_cstm.module_7_code_c,mg_st_student_cstm.crs_code_c,mg_st_student_cstm.address_status_c,mg_st_student_cstm.mtg_meeting_notes_id_c,mg_st_student_cstm.agent_name_c,mg_st_student_cstm.next_ofkin_name_c,mg_st_student_cstm.permission_progression_pg_c,mg_st_student_cstm.disability_disclosed_c,mg_st_student_cstm.visa_notes_c,mg_st_student_cstm.academic_qualification_overa_c,mg_st_student_cstm.progressor_type_c,mg_st_student_cstm.greater_region_c,mg_st_student_cstm.behaviour_disciplinary_c,mg_st_student_cstm.at_risk_action_plan_c,mg_st_student_cstm.regional_manager_c,mg_st_student_cstm.module_7_name_c,mg_st_student_cstm.permission_enrolment_pg_c,mg_st_student_cstm.module_4_iteration_c,mg_st_student_cstm.student_category_c,mg_st_student_cstm.english_qual_is_selt_c,mg_st_student_cstm.module_4_code_c,mg_st_student_cstm.passport_number_c,mg_st_student_cstm.module_2_name_c,mg_st_student_cstm.at_risk_reason_multi_c,mg_st_student_cstm.module_5_iteration_c,mg_st_student_cstm.destination_university_c,mg_st_student_cstm.passport_place_of_issue_c,mg_st_student_cstm.aruaa_notes_c,mg_st_student_cstm.module_3_iteration_c,mg_st_student_cstm.academic_qualification_name_c,mg_st_student_cstm.attendance_warning_stage_c,mg_st_student_cstm.current_student_status_c,mg_st_student_cstm.agent_type_c,mg_st_student_cstm.module_3_name_c,mg_st_student_cstm.country_of_birth_c,mg_st_student_cstm.module_2_iteration_c,mg_st_student_cstm.mg_mo_aruaa_id_c,mg_st_student_cstm.selfcerts_c,mg_st_student_cstm.permission_academic_pg_c,mg_st_student_cstm.registration_date_c,mg_st_student_cstm.permission_welfare_pg_c,mg_st_student_cstm.known_as_c,mg_st_student_cstm.into_pay_link_c,mg_st_student_cstm.course_type_c,mg_st_student_cstm.next_of_kin_relationship_c,mg_st_student_cstm.term_time_address_2_c,mg_st_student_cstm.late_arriver_for_course_c,mg_st_student_cstm.module_2_code_c,mg_st_student_cstm.photo_c,mg_st_student_cstm.academic_qualification_notes_c,mg_st_student_cstm.permission_welfare_agent_c,mg_st_student_cstm.onboarding_status_c,mg_st_student_cstm.mg_mo_modules_id6_c,mg_st_student_cstm.award_classification_uos_c,mg_st_student_cstm.degreemajor_c,mg_st_student_cstm.integrated_course_c,mg_st_student_cstm.mg_mo_welfarenotes_id_c,mg_st_student_cstm.on_track_c,mg_st_student_cstm.agent_urn_c,mg_st_student_cstm.intake_month_c,mg_st_student_cstm.module_6_iteration_c,mg_st_student_cstm.action_plan_c,mg_st_student_cstm.at_risk_reason_c,mg_st_student_cstm.passport_issue_date_c,mg_st_student_cstm.term_time_region_c,mg_st_student_cstm.cas_number_c , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , ‘Users’ modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , ‘Users’ created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, jt3.name module_1 , jt4.name module_2 , jt5.name module_3 , jt6.name module_4 , jt7.name module5 , jt8.name module6 , jt9.name mg_mo_aruaa_mg_st_student_name, jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida , jt10.name mg_mo_welfarenotes_mg_st_student_1_name, jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida, jt11.name module_7_c , jt12.name pt_notes_c , jt13.name welfare_notes_c , LTRIM(RTRIM(CONCAT(IFNULL(jt14.document_name,‘’)))) meeting_notes_c , jt15.name pt_module_c , jt16.name module_8_c , jt17.name aruaa_c , jt18.name cases_c FROM mg_st_student LEFT JOIN mg_st_student_cstm ON mg_st_student.id = mg_st_student_cstm.id_c LEFT JOIN users jt0 ON mg_st_student.modified_user_id=jt0.id AND jt0.deleted=0

AND jt0.deleted=0 LEFT JOIN users jt1 ON mg_st_student.created_by=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 LEFT JOIN users jt2 ON mg_st_student.assigned_user_id=jt2.id AND jt2.deleted=0

AND jt2.deleted=0 LEFT JOIN mg_mo_modules jt3 ON mg_st_student.mg_mo_modules_id_c = jt3.id AND jt3.deleted=0 LEFT JOIN mg_mo_modules jt4 ON mg_st_student.mg_mo_modules_id1_c = jt4.id AND jt4.deleted=0 LEFT JOIN mg_mo_modules jt5 ON mg_st_student.mg_mo_modules_id2_c = jt5.id AND jt5.deleted=0 LEFT JOIN mg_mo_modules jt6 ON mg_st_student.mg_mo_modules_id3_c = jt6.id AND jt6.deleted=0 LEFT JOIN mg_mo_modules jt7 ON mg_st_student.mg_mo_modules_id4_c = jt7.id AND jt7.deleted=0 LEFT JOIN mg_mo_modules jt8 ON mg_st_student.mg_mo_modules_id5_c = jt8.id AND jt8.deleted=0 LEFT JOIN mg_mo_aruaa_mg_st_student_c jtl9 ON mg_st_student.id=jtl9.mg_mo_aruaa_mg_st_studentmg_st_student_idb AND jtl9.deleted=0

LEFT JOIN mg_mo_aruaa jt9 ON jt9.id=jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida AND jt9.deleted=0
AND jt9.deleted=0 LEFT JOIN mg_mo_welfarenotes_mg_st_student_1_c jtl10 ON mg_st_student.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_st_student_idb AND jtl10.deleted=0

LEFT JOIN mg_mo_welfarenotes jt10 ON jt10.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida AND jt10.deleted=0
AND jt10.deleted=0 LEFT JOIN mg_mo_modules jt11 ON mg_st_student_cstm.mg_mo_modules_id6_c = jt11.id AND jt11.deleted=0 LEFT JOIN pt_pt_notes jt12 ON mg_st_student_cstm.pt_pt_notes_id_c = jt12.id AND jt12.deleted=0 LEFT JOIN mg_mo_welfarenotes jt13 ON mg_st_student_cstm.mg_mo_welfarenotes_id_c = jt13.id AND jt13.deleted=0 LEFT JOIN mtg_meeting_notes jt14 ON mg_st_student_cstm.mtg_meeting_notes_id_c = jt14.id AND jt14.deleted=0 LEFT JOIN mg_mo_modules jt15 ON mg_st_student_cstm.mg_mo_modules_id12_c = jt15.id AND jt15.deleted=0 LEFT JOIN mg_mo_modules jt16 ON mg_st_student_cstm.mg_mo_modules_id7_c = jt16.id AND jt16.deleted=0 LEFT JOIN mg_mo_aruaa jt17 ON mg_st_student_cstm.mg_mo_aruaa_id_c = jt17.id AND jt17.deleted=0 LEFT JOIN mg_st_student jt18 ON mg_st_student_cstm. = jt18.id AND jt18.deleted=0 where (mg_st_student.id in (‘IN58E3068778Q’,‘IN58A7933982Q’,‘IN58A7869775Q’,‘IN58A7998223Q’,‘IN58E2878139Q’,‘IN58A7957685Q’,‘IN58E2889219Q’,‘IN58A7957473Q’,‘IN58E2863832Q’,‘IN58A7928967Q’,‘IN58A7953775Q’,‘IN58A7951090Q’,‘IN58A8001044Q’,‘IN58A8006348Q’,‘IN58A8017043Q’,‘IN58A8042459Q’,‘IN58A7892945Q’,‘IN58A8022452Q’,‘IN58E3051159Q’,‘IN58A7984472Q’,‘IN58A7949163Q’,‘IN58A7984661Q’,‘IN58E3010856Q’,‘IN58A8026039Q’,‘IN58E3005532Q’,‘IN58A7991026Q’,‘IN58E2974816Q’,‘IN58A7926512Q’,‘IN58A7966819Q’,‘IN58A8001418Q’,‘IN58E2985717Q’,‘IN58E3056855Q’,‘IN58E2836720Q’,‘IN58E3026915Q’,‘IN58E2967421Q’,‘IN58E2975008Q’,‘IN58A7963419Q’,‘IN58E3102543Q’,‘IN58E2980859Q’,‘IN58A8021419Q’,‘IN58A8031145Q’,‘IN58A8023233Q’,‘IN58E2809335Q’,‘IN58E3104359Q’,‘IN58E3052908Q’,‘IN58A7930173Q’,‘IN58A7971527Q’,‘IN58A7969483Q’,‘IN58E2980512Q’,‘IN58A7999412Q’)) AND mg_st_student.deleted=0 Query Failed: SELECT mg_st_student.* ,mg_st_student_cstm.passport_expiry_date_c,mg_st_student_cstm.pm_c,mg_st_student_cstm.visa_application_status_c,mg_st_student_cstm.mg_mo_modules_id7_c,mg_st_student_cstm.debt_amount_c,mg_st_student_cstm.date_arrived_late_c,mg_st_student_cstm.source_of_application_c,mg_st_student_cstm.module_4_name_c,mg_st_student_cstm.acase_id_c,mg_st_student_cstm.parent_type,mg_st_student_cstm.module_6_code_c,mg_st_student_cstm.previous_am_c,mg_st_student_cstm.module_5_code_c,mg_st_student_cstm.student_meeting_notes_c,mg_st_student_cstm.parent_id,mg_st_student_cstm.permission_academic_agent_c,mg_st_student_cstm.programmetype_c,mg_st_student_cstm.module_6_name_c,mg_st_student_cstm.passport_place_of_birth_c,mg_st_student_cstm.personal_tutor_menu_c,mg_st_student_cstm.passport_notes_c,mg_st_student_cstm.cas_created_date_c,mg_st_student_cstm.cas_status_c,mg_st_student_cstm.module__5_name_c,mg_st_student_cstm.age_at_course_start_c,mg_st_student_cstm.visa_checked_c,mg_st_student_cstm.current_study_location_c,mg_st_student_cstm.welfare_notes_text_area_c,mg_st_student_cstm.reason_for_leaving_notes_c,mg_st_student_cstm.pt_pt_notes_id_c,mg_st_student_cstm.term_time_address_monitoring_c,mg_st_student_cstm.sen_notes_c,mg_st_student_cstm.term_time_address_3_c,mg_st_student_cstm.pt_notes_text_area_c,mg_st_student_cstm.module_1_iteration_c,mg_st_student_cstm.module_7_iteration_c,mg_st_student_cstm.english_qualification_notes_c,mg_st_student_cstm.meeting_notes_text_area_c,mg_st_student_cstm.module_1_code_c,mg_st_student_cstm.uosfaculty_c,mg_st_student_cstm.country_of_residence_c,mg_st_student_cstm.programme_manager_c,mg_st_student_cstm.accommodation_allocated_c,mg_st_student_cstm.regional_manager_email_c,mg_st_student_cstm.final_university_degree_c,mg_st_student_cstm.academicyear_c,mg_st_student_cstm.module_8_iteration_c,mg_st_student_cstm.module_3_code_c,mg_st_student_cstm.module_8_name_c,mg_st_student_cstm.permission_welfare_sponsor_c,mg_st_student_cstm.year_of_exit_uos_c,mg_st_student_cstm.degree_outcome_c,mg_st_student_cstm.academic_awarding_body_c,mg_st_student_cstm.last_educational_institution_c,mg_st_student_cstm.permission_attendance_pg_c,mg_st_student_cstm.module_1_name_c,mg_st_student_cstm.academic_qualification_date_c,mg_st_student_cstm.module_8_code_c,mg_st_student_cstm.mg_mo_modules_id12_c,mg_st_student_cstm.permission_attendance_agent_c,mg_st_student_cstm.award_name_uos_c,mg_st_student_cstm.course_name_c,mg_st_student_cstm.cas_evidence_c,mg_st_student_cstm.sits_id_c,mg_st_student_cstm.reg_form_completed_c,mg_st_student_cstm.non_submission_c,mg_st_student_cstm.personal_tutor_c,mg_st_student_cstm.permitted_to_attend_class_c,mg_st_student_cstm.sponsored_c,mg_st_student_cstm.last_response_c,mg_st_student_cstm.age_c,mg_st_student_cstm.module_7_code_c,mg_st_student_cstm.crs_code_c,mg_st_student_cstm.address_status_c,mg_st_student_cstm.mtg_meeting_notes_id_c,mg_st_student_cstm.agent_name_c,mg_st_student_cstm.next_ofkin_name_c,mg_st_student_cstm.permission_progression_pg_c,mg_st_student_cstm.disability_disclosed_c,mg_st_student_cstm.visa_notes_c,mg_st_student_cstm.academic_qualification_overa_c,mg_st_student_cstm.progressor_type_c,mg_st_student_cstm.greater_region_c,mg_st_student_cstm.behaviour_disciplinary_c,mg_st_student_cstm.at_risk_action_plan_c,mg_st_student_cstm.regional_manager_c,mg_st_student_cstm.module_7_name_c,mg_st_student_cstm.permission_enrolment_pg_c,mg_st_student_cstm.module_4_iteration_c,mg_st_student_cstm.student_category_c,mg_st_student_cstm.english_qual_is_selt_c,mg_st_student_cstm.module_4_code_c,mg_st_student_cstm.passport_number_c,mg_st_student_cstm.module_2_name_c,mg_st_student_cstm.at_risk_reason_multi_c,mg_st_student_cstm.module_5_iteration_c,mg_st_student_cstm.destination_university_c,mg_st_student_cstm.passport_place_of_issue_c,mg_st_student_cstm.aruaa_notes_c,mg_st_student_cstm.module_3_iteration_c,mg_st_student_cstm.academic_qualification_name_c,mg_st_student_cstm.attendance_warning_stage_c,mg_st_student_cstm.current_student_status_c,mg_st_student_cstm.agent_type_c,mg_st_student_cstm.module_3_name_c,mg_st_student_cstm.country_of_birth_c,mg_st_student_cstm.module_2_iteration_c,mg_st_student_cstm.mg_mo_aruaa_id_c,mg_st_student_cstm.selfcerts_c,mg_st_student_cstm.permission_academic_pg_c,mg_st_student_cstm.registration_date_c,mg_st_student_cstm.permission_welfare_pg_c,mg_st_student_cstm.known_as_c,mg_st_student_cstm.into_pay_link_c,mg_st_student_cstm.course_type_c,mg_st_student_cstm.next_of_kin_relationship_c,mg_st_student_cstm.term_time_address_2_c,mg_st_student_cstm.late_arriver_for_course_c,mg_st_student_cstm.module_2_code_c,mg_st_student_cstm.photo_c,mg_st_student_cstm.academic_qualification_notes_c,mg_st_student_cstm.permission_welfare_agent_c,mg_st_student_cstm.onboarding_status_c,mg_st_student_cstm.mg_mo_modules_id6_c,mg_st_student_cstm.award_classification_uos_c,mg_st_student_cstm.degreemajor_c,mg_st_student_cstm.integrated_course_c,mg_st_student_cstm.mg_mo_welfarenotes_id_c,mg_st_student_cstm.on_track_c,mg_st_student_cstm.agent_urn_c,mg_st_student_cstm.intake_month_c,mg_st_student_cstm.module_6_iteration_c,mg_st_student_cstm.action_plan_c,mg_st_student_cstm.at_risk_reason_c,mg_st_student_cstm.passport_issue_date_c,mg_st_student_cstm.term_time_region_c,mg_st_student_cstm.cas_number_c , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , ‘Users’ modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , ‘Users’ created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, jt3.name module_1 , jt4.name module_2 , jt5.name module_3 , jt6.name module_4 , jt7.name module5 , jt8.name module6 , jt9.name mg_mo_aruaa_mg_st_student_name, jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida , jt10.name mg_mo_welfarenotes_mg_st_student_1_name, jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida, jt11.name module_7_c , jt12.name pt_notes_c , jt13.name welfare_notes_c , LTRIM(RTRIM(CONCAT(IFNULL(jt14.document_name,‘’)))) meeting_notes_c , jt15.name pt_module_c , jt16.name module_8_c , jt17.name aruaa_c , jt18.name cases_c FROM mg_st_student LEFT JOIN mg_st_student_cstm ON mg_st_student.id = mg_st_student_cstm.id_c LEFT JOIN users jt0 ON mg_st_student.modified_user_id=jt0.id AND jt0.deleted=0

AND jt0.deleted=0 LEFT JOIN users jt1 ON mg_st_student.created_by=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 LEFT JOIN users jt2 ON mg_st_student.assigned_user_id=jt2.id AND jt2.deleted=0

AND jt2.deleted=0 LEFT JOIN mg_mo_modules jt3 ON mg_st_student.mg_mo_modules_id_c = jt3.id AND jt3.deleted=0 LEFT JOIN mg_mo_modules jt4 ON mg_st_student.mg_mo_modules_id1_c = jt4.id AND jt4.deleted=0 LEFT JOIN mg_mo_modules jt5 ON mg_st_student.mg_mo_modules_id2_c = jt5.id AND jt5.deleted=0 LEFT JOIN mg_mo_modules jt6 ON mg_st_student.mg_mo_modules_id3_c = jt6.id AND jt6.deleted=0 LEFT JOIN mg_mo_modules jt7 ON mg_st_student.mg_mo_modules_id4_c = jt7.id AND jt7.deleted=0 LEFT JOIN mg_mo_modules jt8 ON mg_st_student.mg_mo_modules_id5_c = jt8.id AND jt8.deleted=0 LEFT JOIN mg_mo_aruaa_mg_st_student_c jtl9 ON mg_st_student.id=jtl9.mg_mo_aruaa_mg_st_studentmg_st_student_idb AND jtl9.deleted=0

LEFT JOIN mg_mo_aruaa jt9 ON jt9.id=jtl9.mg_mo_aruaa_mg_st_studentmg_mo_aruaa_ida AND jt9.deleted=0
AND jt9.deleted=0 LEFT JOIN mg_mo_welfarenotes_mg_st_student_1_c jtl10 ON mg_st_student.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_st_student_idb AND jtl10.deleted=0

LEFT JOIN mg_mo_welfarenotes jt10 ON jt10.id=jtl10.mg_mo_welfarenotes_mg_st_student_1mg_mo_welfarenotes_ida AND jt10.deleted=0
AND jt10.deleted=0 LEFT JOIN mg_mo_modules jt11 ON mg_st_student_cstm.mg_mo_modules_id6_c = jt11.id AND jt11.deleted=0 LEFT JOIN pt_pt_notes jt12 ON mg_st_student_cstm.pt_pt_notes_id_c = jt12.id AND jt12.deleted=0 LEFT JOIN mg_mo_welfarenotes jt13 ON mg_st_student_cstm.mg_mo_welfarenotes_id_c = jt13.id AND jt13.deleted=0 LEFT JOIN mtg_meeting_notes jt14 ON mg_st_student_cstm.mtg_meeting_notes_id_c = jt14.id AND jt14.deleted=0 LEFT JOIN mg_mo_modules jt15 ON mg_st_student_cstm.mg_mo_modules_id12_c = jt15.id AND jt15.deleted=0 LEFT JOIN mg_mo_modules jt16 ON mg_st_student_cstm.mg_mo_modules_id7_c = jt16.id AND jt16.deleted=0 LEFT JOIN mg_mo_aruaa jt17 ON mg_st_student_cstm.mg_mo_aruaa_id_c = jt17.id AND jt17.deleted=0 LEFT JOIN mg_st_student jt18 ON mg_st_student_cstm. = jt18.id AND jt18.deleted=0 where (mg_st_student.id in (‘IN58E3068778Q’,‘IN58A7933982Q’,‘IN58A7869775Q’,‘IN58A7998223Q’,‘IN58E2878139Q’,‘IN58A7957685Q’,‘IN58E2889219Q’,‘IN58A7957473Q’,‘IN58E2863832Q’,‘IN58A7928967Q’,‘IN58A7953775Q’,‘IN58A7951090Q’,‘IN58A8001044Q’,‘IN58A8006348Q’,‘IN58A8017043Q’,‘IN58A8042459Q’,‘IN58A7892945Q’,‘IN58A8022452Q’,‘IN58E3051159Q’,‘IN58A7984472Q’,‘IN58A7949163Q’,‘IN58A7984661Q’,‘IN58E3010856Q’,‘IN58A8026039Q’,‘IN58E3005532Q’,‘IN58A7991026Q’,‘IN58E2974816Q’,‘IN58A7926512Q’,‘IN58A7966819Q’,‘IN58A8001418Q’,‘IN58E2985717Q’,‘IN58E3056855Q’,‘IN58E2836720Q’,‘IN58E3026915Q’,‘IN58E2967421Q’,‘IN58E2975008Q’,‘IN58A7963419Q’,‘IN58E3102543Q’,‘IN58E2980859Q’,‘IN58A8021419Q’,‘IN58A8031145Q’,‘IN58A8023233Q’,‘IN58E2809335Q’,‘IN58E3104359Q’,‘IN58E3052908Q’,‘IN58A7930173Q’,‘IN58A7971527Q’,‘IN58A7969483Q’,‘IN58E2980512Q’,‘IN58A7999412Q’)) AND mg_st_student.deleted=0

When you copy/paste this query into an online SQL syntax checker tool such as this one:

It gives you:this result:

[
	"There is one or more errors in your SQL syntax",
	"",
	"Line 13, col 1680: This type of clause was previously parsed. SELECT"
]

The question is, was that syntax error caused by Suite, or by an Add-on / customization?

Two things have changed recently, I’m not sure whether either of them might be the cause of this error. One is that I migrated to a different hosting company and am therefore on a different server. The other is that I added in some new relate fields to link Cases to a custom module I have been using for a long time.
Any suggestions much appreciated, SQL is a bit beyond me sometimes.

I don’t think PHP 8.1 works with v7.12 :thinking:

Ok, my mistake. 8.1 is the system version but 7.4 is applied to this domain.

Can you ask the custom module developer customer support, to look at this SQL error and see if the issue might be in their module.

Unfortunately not, they were employed by us at the time but we don’t have anyone else with SQL knowledge now. The custom module has been running without any problems for almost 5 years which makes me think that it’s been caused either when I moved host or added in the additional relate fields. I’ve been systematically removing all the relate fields but the error is still there. I’ve found one field that refuses to delete (cases_c) so I wonder if it’s the source of the issue.