我有这个查询,我想优化它。我使用一个 SELECT 和一个子查询,如果可能的话,我只想使用一个 SELECT。
有人对此有任何想法吗?
先感谢您
SELECT c.*
FROM course AS c
JOIN student_course AS sc ON c.id = uc.course_id
WHERE sc.student_id = '5' AND c.level = (SELECT MAX(level)
FROM course
JOIN student_course ON c.id = sc.course_id)
GROUP BY c.category_id