I have a database with tables Student(StudId, StudName,...) and Grades (GradeExam1, GradeExam2,..) etc. And I want to do a query to assign a letter grade to each grade. I am thinking of doing something like:
SELECT StudId, GradeExam1 AS 'A' IF GradeExam1>= 90 AND GradeExam1 <=100 UNION SELECT StudID, GradeExam1 AS 'B' ..........
I know that I can use non-conditional aliases within plain SQL, but I have never done conditional aliases within an SQL query.
Or maybe I need T-SQL in order to do a loop for a given exam, instead of doing a union of select statements for different conditions?
Thanks in Advance.