Re: Subselects, the Oracle way - Mailing list pgsql-sql

From Joe Conway
Subject Re: Subselects, the Oracle way
Date
Msg-id 01d901c0f833$ccef28a0$48d210ac@jecw2k1
Whole thread Raw
In response to Subselects, the Oracle way  ("Svenne Krap" <svenne@krap.dk>)
List pgsql-sql
> Is there any way to mimic the oracle way of subselect, especially
> constructs like
>
>
> select * from (select col1 as x, col2, col6 from t1 union select col2
> as x, col6, col2 from t2) y order by y.x
>

Works fine as written in version 7.1 and above. See
http://www.postgresql.org/idocs/index.php?queries.html#QUERIES-FROM

test=# select version();                             version
-------------------------------------------------------------------PostgreSQL 7.1 on i686-pc-linux-gnu, compiled by GCC
egcs-2.91.66
(1 row)

test=# select * from (select col1 as x, col2, col6 from t1 union select col2
as x, col6, col2 from t2) y order by y.x;x | col2 | col6
---+------+------1 |    1 |    12 |    2 |    23 |    3 |    34 |    4 |    4
(4 rows)

-- Joe



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: LEFT JOIN ...
Next
From: The Hermit Hacker
Date:
Subject: Re: LEFT JOIN ...