Link to home
Start Free TrialLog in
Avatar of cnxmax
cnxmax

asked on

Referencing Variable Selected Fields in Where Clause

I'm trying to get a variable field name created with "AS" in the select clause to work in the Where clause.

Is this possible? Is there another solution?

This code works without the Var_Priorty <= 2
SELECT page_ID, page_title, 
CASE 
WHEN page_tag = 'howdy' THEN 1 
WHEN page_tag = 'doo' THEN 2 
ELSE 99 END As Var_Priority
FROM table_pages
WHERE page_ID > 100
AND Var_Priority <= 2

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of folderol
folderol

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

ASKER

That will work in a pinch. Thanks for your help.