LMSouq
moodle-core Open

Invalid reference to FROM-clause entry for table "mdl_user"

DR
Drew Chapin
1 month ago
3 views
Problem Description
I'm trying to build a report of all users and their score for a particular course for a Moodle v2.7 database (which uses PostgreSQL 9.3. I am getting the following error and have looked at questions and other examples that produce the same error, but none of them provide an answer for my specific problem. Not sure what I'm overlooking here. > ERROR: Invalid reference to FROM-clause entry for table "mdl_user" SELECT mdl_user.lastname as LastName, mdl_user.firstname as FirstName, Grr.finalgrade as Grade, REPLACE(Grr.itemname,'COURSE: ','') as Course, TO_CHAR(TO_TIMESTAMP(Grr.timemodified), 'MM/DD/YYYY') as Completed FROM public.mdl_user LEFT JOIN ( SELECT mdl_grade_grades.finalgrade, mdl_grade_items.itemname, mdl_grade_grades.userid, mdl_grade_grades.timemodified FROM public.mdl_grade_items LEFT JOIN public.mdl_grade_grades ON public.mdl_grade_items.id = public.mdl_grade_grades.itemid WHERE mdl_grade_grades.userid = mdl_user.id AND mdl_grade_items.itemname LIKE 'COURSE: Lock Out Tag Out: ECP' ) AS Grr ON Grr.userid = public.mdl_user.id ORDER BY mdl_user.lastname, mdl_user.firstname

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base