I am attempting to use a column alias in an OR clause, but I keep getting the error: "Invalid column name 'TEAM NAME'". I've seen threads about using aliases in WHERE clauses, but I'm not sure if OR is possible. Here's what I'm working with:
[TEAM NAME] = CASE WHEN MAX(L.City) IN ('RY','BR') THEN 'Team 1'
WHEN MAX(L.City) IN ('JS','ND') THEN 'Team 2'
WHEN MAX(L.City) IN ('QV','VE') THEN 'Team 3'
WHEN MAX(L.City) IN ('FB','RX') THEN 'Team 4'
ELSE '-' END,
and here is my OR clause
AND (U.Player IN ('Tom Thumb','Wallace Gromit') OR [Team Name] <> '-')