SELECT a.id, b.title, b.identifier,c.rating
FROM mdl_course_modules a
LEFT JOIN mdl_scorm_scoes b
ON a.instance = b.scorm
and b.scormtype = ''
LEFT JOIN training_rating C
ON C.training_id = a.id
and c.user_id = '1'
WHERE a.module='18'
ORDER BY rating DESC
error in : #1054 - Unknown column 'c.rating' in 'field list'
答案 0 :(得分:1)
您将traning_rating
别名为C
,但您将其称为c
(小写),这是错误的原因。请试试这个:
SELECT a.id, b.title, b.identifier,c.rating
FROM mdl_course_modules a
LEFT JOIN mdl_scorm_scoes b
ON a.instance = b.scorm and b.scormtype = ''
LEFT JOIN training_rating c
ON c.training_id = a.id and c.user_id = '1'
WHERE a.module='18'
ORDER BY rating DESC