Using fields form SELECT block in QUALIFY block

Database

Using fields form SELECT block in QUALIFY block

Hello!

Teradata allows to use fields from SELECT block in other blocks. 

A have two tables T1 and T2. And there is a field "a" in table T1 and in T2. And i made a new field in select block^

SELECT 

case when T1.a > T2.a then T1.a else T2.a end AS a

and I want to use this "a" in qualify block. I don't want to write this case again. How can I do it? Are there any special alias for fields from SELECT block?

Thank you!

Tags (3)