Link to home
Start Free TrialLog in
Avatar of Basssque
Basssque

asked on

Oracle Query - Convert letters to numbers and display the difference

The following statements return numbers from a-z but I need a new column to calculate the change as a number.
For example, if the letter for Q1 is B and Q2 is D, then the output would be +2.  If Q1 is D and Q2 is B, the output would be -2
Thanks!
max(CASE WHEN STANDARDGRADESECTION.STORECODE = 'Q1' THEN STANDARDGRADESECTION.STANDARDGRADE else chr(32) END) as "Q1 Reading Level",
max(CASE WHEN STANDARDGRADESECTION.STORECODE = 'Q2' THEN STANDARDGRADESECTION.STANDARDGRADE else chr(32) END) as "Q2 Reading Level"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

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 Basssque
Basssque

ASKER

Perfect, thank you!
You indicate that the statements return numbers  from a-z but show sample values of B and D. To insure being case insensitive, you may want to get the ascii values for upper(standardgrade) or lower(standardgrade). (No points!)