I have written down this query in postgres sql with column alias it is working fine:
select email as e from users
It displays me result under e
column alias but when I fire where
condition with e
then it shows this error:
select email as e from users where e = '[email protected]'
ERROR: column "e" does not exist
Why so? How we can use alias in where condition?
where
is evaluated beforeselect
, so you can't use alias declared inselect
inwhere
clause.