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 before select
, so you can't use alias declared in select
in where
clause.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With