pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSubselects, the Oracle way
4+ messages / 4 participants
[nested] [flat]
* Subselects, the Oracle way
@ 2001-06-18 19:05 Svenne Krap <svenne@krap.dk>
2001-06-18 20:15 ` Re: Subselects, the Oracle way Tom Lane <tgl@sss.pgh.pa.us>
2001-06-18 20:18 ` Re: Subselects, the Oracle way Joe Conway <joseph.conway@home.com>
2001-06-18 20:49 ` Re: Subselects, the Oracle way Peter Eisentraut <peter_e@gmx.net>
0 siblings, 3 replies; 4+ messages in thread
From: Svenne Krap @ 2001-06-18 19:05 UTC (permalink / raw)
To: pgsql-sql
Hi,
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
I am aware of the fact, that it is possible to accomplish through the
use of tempoary tables, but would rather not use them.
Thanks in advance
Svenne
--
svenne@krap.dk
http://www.krap.dk
ICQ 5434480
PGP-key http://keys.pgp.dk:11371/pks/lookup?op=get&search=0xDF484022
PGP @ http://www.pgp.com / http://www.phpi.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Subselects, the Oracle way
2001-06-18 19:05 Subselects, the Oracle way Svenne Krap <svenne@krap.dk>
@ 2001-06-18 20:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2001-06-18 20:15 UTC (permalink / raw)
To: svenne@krap.dk; +Cc: pgsql-sql
"Svenne Krap" <svenne@krap.dk> writes:
> 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
That should work fine in 7.1 ...
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Subselects, the Oracle way
2001-06-18 19:05 Subselects, the Oracle way Svenne Krap <svenne@krap.dk>
@ 2001-06-18 20:18 ` Joe Conway <joseph.conway@home.com>
2 siblings, 0 replies; 4+ messages in thread
From: Joe Conway @ 2001-06-18 20:18 UTC (permalink / raw)
To: svenne@krap.dk; 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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Subselects, the Oracle way
2001-06-18 19:05 Subselects, the Oracle way Svenne Krap <svenne@krap.dk>
@ 2001-06-18 20:49 ` Peter Eisentraut <peter_e@gmx.net>
2 siblings, 0 replies; 4+ messages in thread
From: Peter Eisentraut @ 2001-06-18 20:49 UTC (permalink / raw)
To: Svenne Krap <svenne@krap.dk>; +Cc: pgsql-sql
Svenne Krap writes:
> 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
I don't know what's supposed to be the "Oracle" way about this, but this
particular query should work in PostgreSQL 7.1.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-06-18 20:49 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-18 19:05 Subselects, the Oracle way Svenne Krap <svenne@krap.dk>
2001-06-18 20:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-06-18 20:18 ` Joe Conway <joseph.conway@home.com>
2001-06-18 20:49 ` Peter Eisentraut <peter_e@gmx.net>
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