Re: Mested select into the from of a a Select structure

From: Jakub Ouhrabka <jouh8664(at)ss1000(dot)ms(dot)mff(dot)cuni(dot)cz>
To: Tourtounis Sotiris <tourtoun(at)csd(dot)uoc(dot)gr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Mested select into the from of a a Select structure
Date: 2002-11-09 16:59:41
Message-ID: Pine.LNX.4.44.0211091758040.14308-100000@server
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

try:

select *
from (select Y.col1 AS X from ....) Z, T
where T.col2 = Z.X

'Z' is a table alias in your case, not column alias...

kuba

On Sat, 9 Nov 2002, Tourtounis Sotiris wrote:

>
> Performing an SQL query of the below general form to a table T
>
> Table T :
>
> col1 | col2 | col3
> ------------------
> text | text | text
>
> and the query is ...
>
> select *
> from (select Y.col1 from ....) Z, T
> where T.col2 = Z
>
> I think this query should work - however it throws me an error to the
> where clause, where it says that it doesn't find Z (ERROR: Attribute 'z'
> not found) - can anyone notice any mistake or overlap that i have made - i
> would really appreciate any kind of help or advice - thank you a priori
> !!!
>
>
>
> SWTHRHS TOYRTOYNHS
> (tourtoun(at)csd(dot)uch(dot)gr)
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message snpe 2002-11-09 17:51:41 PostgreSQL JDBC and sub-select
Previous Message Tourtounis Sotiris 2002-11-09 16:49:04 Mested select into the from of a a Select structure