У меня есть две MySQL таблицы, курсы и student_courses, мне нужно получить уникальные имена course_name из таблицы курсов Но я получаю ошибку при попытке выполнить мой запрос.
Вот мой запрос
SELECT
sc.c_id,
DISTINCT c.course_name
FROM
Courses AS c
LEFT JOIN Student_Courses AS sc ON c.c_id = sc.c_id
WHERE
sc.s_id = 4
Это ошибка, которую я получаю
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT c.course_name
FROM
Курсы AS c
LEFT JOIN Student_Courses AS 'в строке 3