pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedsimulate union in subselect
3+ messages / 3 participants
[nested] [flat]
* simulate union in subselect
@ 2001-04-25 22:42 Wei Weng <wweng@kencast.com>
0 siblings, 2 replies; 3+ messages in thread
From: Wei Weng @ 2001-04-25 22:42 UTC (permalink / raw)
To: pgsql-sql
I know this is not do-able, but is there any way to simulate the
following in Postgresql 7.1?
select id from
(select id, recv_date as date from table1
union
select id, send_date as date from table2) AS subtable
order by date;
Thanks a lot
Wei
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: simulate union in subselect
@ 2001-04-26 15:17 Tom Lane <tgl@sss.pgh.pa.us>
parent: Wei Weng <wweng@kencast.com>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2001-04-26 15:17 UTC (permalink / raw)
To: Wei Weng <wweng@kencast.com>; +Cc: pgsql-sql
"Wei Weng" <wweng@kencast.com> writes:
> I know this is not do-able, but is there any way to simulate the
> following in Postgresql 7.1?
> select id from
> (select id, recv_date as date from table1
> union
> select id, send_date as date from table2) AS subtable
> order by date;
What gives you the idea that this doesn't work?
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: simulate union in subselect
@ 2001-04-26 15:44 Peter Eisentraut <peter_e@gmx.net>
parent: Wei Weng <wweng@kencast.com>
1 sibling, 0 replies; 3+ messages in thread
From: Peter Eisentraut @ 2001-04-26 15:44 UTC (permalink / raw)
To: Wei Weng <wweng@kencast.com>; +Cc: pgsql-sql
Wei Weng writes:
> I know this is not do-able, but is there any way to simulate the
> following in Postgresql 7.1?
>
> select id from
> (select id, recv_date as date from table1
> union
> select id, send_date as date from table2) AS subtable
> order by date;
I haven't actually tried whether this does not work, but ISTM that you
could simply do
select id, recv_date as date from table1
union
select id, send_date as date from table2
order by 2;
and ignore the second column when processing the result.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-04-26 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-25 22:42 simulate union in subselect Wei Weng <wweng@kencast.com>
2001-04-26 15:17 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-04-26 15:44 ` 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