Re: Mested select into the from of a a Select structure - Mailing list pgsql-general

From Jakub Ouhrabka
Subject Re: Mested select into the from of a a Select structure
Date
Msg-id Pine.LNX.4.44.0211091758040.14308-100000@server
Whole thread Raw
In response to Mested select into the from of a a Select structure  (Tourtounis Sotiris <tourtoun@csd.uoc.gr>)
List 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@csd.uch.gr)
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


pgsql-general by date:

Previous
From: snpe
Date:
Subject: PostgreSQL JDBC and sub-select
Next
From: Neil Conway
Date:
Subject: Re: Upgrade to dual processor machine?