You should remove UNION and use only lower one. Also, what is the point of CONVERT since the ClassRoom isn't datetime field?
Count will already return 0 so you don't need CASE WHEN returning 0, just give the value, you're using LEFT JOIN which will return all the values so again, UNION IS NOT NEEDED.
SELECT DISTINCT list, MAX(cc) FROM (
SELECT DISTINCT CAST(ClassRoom as varchar(10)) +' > ' + CAST(ClassStrength as varchar(5)) +' > ' + CAST(Count(Seatno) as varchar(10)) as List, Classroom ,Count(Seatno) as cc
FROM
ClassRoom
LEFT JOIN Matrix on matrix.roomno=classroom.classroom
WHERE
examid=1 and examname='MST1' and classstrength is not null
GROUP BY
classroom.classroom,ClassStrength
) t
GROUP BY list
If I missed something important with CONVERT (maybe its your culture settings dependant) simply change casts back to converts :)
If this helps please take time to accept the solution. Thank you.