Re: UNION but with excused columns

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: UNION but with excused columns
Дата
Msg-id CAKJS1f-rQVrJ6V4hBsed6ZeHBEFwi_R6shz8fvU51pGEM9GwDA@mail.gmail.com
обсуждение исходный текст
Ответ на UNION but with excused columns  (Mike Rowan <michael.rowan3@gmail.com>)
Список pgsql-novice
On 28 May 2018 at 13:36, Mike Rowan <michael.rowan3@gmail.com> wrote:
> I would like to use UNION to amalgamate two result sets, but I need to
> excuse some columns (the same columns in each set) from the matching
> requirement.  The unmatched columns are the same data type, but not the same
> data.
>
> Is this possible, and if so, any clues?

Yes, just use a sub-query: e.g: SELECT a,b,c FROM (SELECT a,b,c,d FROM
t1 UNION SELECT a,b,c,d FROM t2) t;

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Mike Rowan
Дата:
Сообщение: UNION but with excused columns
Следующее
От: john snow
Дата:
Сообщение: does postgresql 10 have something similar to sql server's set identity_insert