Received: from mailsys01.intnet.net (antares.intnet.net [198.252.32.143]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5IKIHa69248 for ; Mon, 18 Jun 2001 16:18:18 -0400 (EDT) (envelope-from joseph.conway@home.com) Received: from [206.19.64.3] (HELO jecw2k1) by mailsys01.intnet.net (CommuniGate Pro SMTP 3.3.2) with SMTP id 9961167; Mon, 18 Jun 2001 16:17:14 -0400 Message-ID: <01d901c0f833$ccef28a0$48d210ac@jecw2k1> From: "Joe Conway" To: , References: <3B2E6D28.17314.A02C932@localhost> Subject: Re: Subselects, the Oracle way Date: Mon, 18 Jun 2001 13:18:12 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200106/271 X-Sequence-Number: 3532 > 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