Is it possible to define variable within a case statement?
If I had three case statements that worked out different calculations. Could I give each case statement a variable which is equal to the value found, which I could call globally to do other calculations.
Case statement 1
WHEN theme_keywords.CompetingPages < 50000 THEN theme_keywords.CompetingPages/4000
WHEN theme_keywords.CompetingPages > 50001 AND theme_keywords.CompetingPages <= 1100000 THEN theme_keywords.CompetingPages/15000
WHEN theme_keywords.CompetingPages > 1100001 AND theme_keywords.CompetingPages <= 10000000 THEN theme_keywords.CompetingPages/12000
WHEN theme_keywords.CompetingPages > 10000001 AND theme_keywords.CompetingPages <= 20000000 THEN theme_keywords.CompetingPages/9000
WHEN theme_keywords.CompetingPages > 20000001 AND theme_keywords.CompetingPages <= 30000000 THEN theme_keywords.CompetingPages/8500
WHEN theme_keywords.CompetingPages > 30000001 AND theme_keywords.CompetingPages <= 40000000 THEN theme_keywords.CompetingPages/8000
WHEN theme_keywords.CompetingPages > 40000001 AND theme_keywords.CompetingPages <= 213000000 THEN theme_keywords.CompetingPages/7800
WHEN theme_keywords.CompetingPages > 213000000 THEN theme_keywords.CompetingPages/7500
END,0) AS SBL,
If I had case statement 2
case statement 3
and wanted to take
case statement 1 + case statement 2 + case statement 3 and add them all together to get a value as an example how would I do this?
Is this possible?