Come faccio a far funzionare tutto questo, funziona senza la Clausola Where, altrimenti con la clausola Where, ottengo l'errore ovvio, ma questo è fondamentalmente ciò che deve essere fatto, qualcuno sa come affrontarlo?Utilizzo di alias in Clausola Where o un'opzione alternativa?
select ID,
Name,
case T.N
when 1 then City1
when 2 then City2
when 3 then City3
end as City,
case T.N
when 1 then State1
when 2 then State2
when 3 then State3
end as State
from YourTable
cross join (values(1),(2),(3)) as T(N)
Where City is NOT Null
Speriamo che lo scopo di questa query è in modo da poter risolvere il tuo struttura della tabella e metterla in prima forma normale. –