Re: simulate union in subselect

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: simulate union in subselect
Дата
Msg-id Pine.LNX.4.30.0104261743360.758-100000@peter.localdomain
обсуждение исходный текст
Ответ на simulate union in subselect  ("Wei Weng" <wweng@kencast.com>)
Список 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



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: problem with pl/pgsql
Следующее
От: Tom Lane
Дата:
Сообщение: Re: simulate union in subselect