Re: Subselects, the Oracle way

From: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
To: <svenne(at)krap(dot)dk>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Subselects, the Oracle way
Date: 2001-06-18 20:18:12
Message-ID: 01d901c0f833$ccef28a0$48d210ac@jecw2k1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 | 1
2 | 2 | 2
3 | 3 | 3
4 | 4 | 4
(4 rows)

-- Joe

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Svenne Krap 2001-06-18 20:39:36 Re: Subselects, the Oracle way - slightly OT
Previous Message The Hermit Hacker 2001-06-18 20:17:00 Re: LEFT JOIN ...