using calculated column in where-clause - Mailing list pgsql-sql

From Patrick Scharrenberg
Subject using calculated column in where-clause
Date
Msg-id 48582290.6050402@web.de
Whole thread Raw
Responses Re: using calculated column in where-clause  (Andreas Kretschmer <akretschmer@spamfence.net>)
Re: using calculated column in where-clause  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Re: using calculated column in where-clause  ("Fernando Hevia" <fhevia@ip-tel.com.ar>)
List pgsql-sql
Hi!

I'd like to do some calculation with values from the table, show them a
new column and use the values in a where-clause.

Something like this
select a, b , a*b as c from ta where c=2;

But postgresql complains, that column "c" does not exist.

Do I have to repeat the calculation (which might be even more complex
:-) ) in the "where"-clause, or is there a better way?


Thanks in advance.

Best regards
Patrick


pgsql-sql by date:

Previous
From: TJ O'Donnell
Date:
Subject: cool code_swarm animation of PostgreSQL development since 1996
Next
From: Andreas Kretschmer
Date:
Subject: Re: using calculated column in where-clause