Im trying to use 2 CASE statements together in a SELECT query without much luck.
The second CASE uses the output from the first CASE as it’s expression (well it’s supposed to).
When the 2nd CASE statement is removed it works, but when it is included i get this error:
The second CASE uses the output from the first CASE as it’s expression (well it’s supposed to).
When the 2nd CASE statement is removed it works, but when it is included i get this error:
Invalid column name 'balanceCalcula tion'.
Code:
SELECT accountNum ,balanceCalculation = CASE WHEN Balance > 5000 THEN Balance *2 ELSE Balance /2 END ,balanceDescription = CASE WHEN balanceCalculation > 6000 THEN ‘Large Balance’ ELSE ’small balance’ END FROM tblFinances
Comment