To
get the maximum and minimum values of the students
SELECT ID, MIN(Q) AS Lowest, MAX(Q) AS Highest
FROM (
SELECT ID, Q1 AS Q FROM Table1 UNION ALL
SELECT ID, Q2 FROM Table1 UNION ALL
SELECT ID, Q3 FROM Table1 UNION ALL
SELECT ID, Q4 FROM Table1
) AS d
GROUP BY ID
ORDER BY ID
No comments:
Post a Comment