pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <joseph.conway@home.com>
To: svenne@krap.dk
To: pgsql-sql@postgresql.org
Subject: Re: Subselects, the Oracle way
Date: Mon, 18 Jun 2001 13:18:12 -0700
Message-ID: <01d901c0f833$ccef28a0$48d210ac@jecw2k1> (raw)
References: <3B2E6D28.17314.A02C932@localhost>

> 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




view thread (4+ messages)  latest in thread

Message-ID: <01d901c0f833$ccef28a0$48d210ac@jecw2k1>
Permalink:  ../01d901c0f833$ccef28a0$48d210ac@jecw2k1/
Also on:    postgresql.org/message-id/01d901c0f833$ccef28a0$48d210ac@jecw2k1

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: joseph.conway@home.com, svenne@krap.dk
  Subject: Re: Subselects, the Oracle way
  In-Reply-To: <01d901c0f833$ccef28a0$48d210ac@jecw2k1>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox