The following query gives the error "# 1241 - The operand must contain 1 column" because of the row (Department_Code, Course_Code). When I replace it simply (Course_Code), it works. However, this is not what I want.
SELECT * FROM Classes
GROUP BY CASE
WHEN (1) THEN
Department_Code
ELSE CASE WHEN (2) THEN
(Department_Code, Course_Code)
ELSE Class_ID
END
END
How can I group by the Department_Code, Course_Code method when condition (2) is satisfied?
source
share