referring to calculated column in sub select

From: Scara Maccai <m_lists(at)yahoo(dot)it>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: referring to calculated column in sub select
Date: 2009-05-18 13:49:30
Message-ID: 774626.9811.qm@web24615.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi,

why column "acoltest" is not found by the subselect in this select:

SELECT
acol + 100 as acoltest,
(select max(t) from mytab where anothercol=acoltest) as col2
FROM mytab2
group by somet
???
Only columns belonging to a table can be used in a subselect??? What about "calculated" columns?
Thank you

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-05-18 14:27:57 Re: Is this a bug or a feature? Column visibility in subquery from outer query
Previous Message Albe Laurenz 2009-05-18 13:41:27 Re: Need help