Link to home
Start Free TrialLog in
Avatar of dbrennecke
dbrennecke

asked on

IFor CASE within a SELECT

Here is generally what I am trying to do... but is not allowed. How can I properly structure this in sql? Essentially I don't want to return the numeric value for "grade", but replace it with a letter. Help!?

Select <a bunch of stuff>
(if grade > = 90) then return 'A' as 'grade'
from multiple joined tables
where <conditions>
ASKER CERTIFIED SOLUTION
Avatar of Daniel Wilson
Daniel Wilson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dbrennecke
dbrennecke

ASKER

Not exactly what I was looking for...but it did encourage me to look in the right direction. SQL code ended up being:
'letter' = CASE
      WHEN grade > THEN 'A'
      WHEN ...
                     ELSE 'F'
END