Re: table unions

Поиск
Список
Период
Сортировка
От Sean Davis
Тема Re: table unions
Дата
Msg-id 264855a00808080849h7f960d5cw3d1a1e57e5881377@mail.gmail.com
обсуждение исходный текст
Ответ на table unions  ("Wright, George" <George.Wright@infimatic.com>)
Ответы Re: table unions
Список pgsql-novice
On Fri, Aug 8, 2008 at 11:13 AM, Wright, George
<George.Wright@infimatic.com> wrote:
> Novice question:
>
> How can I apply conditional logic when doing a union of two tables?
>
> TableA                       TableB
> ------                      ------
> value1  value2               value1  value2
>   1      10                    5      15
>  11      20
>
> SELECT * FROM TableA UNION SELECT * FROM TableB;
> returns:
>
> value1  value2
>   1      10
>   5      15
>  11      20
>
>
> what I want is
>
> value1  value2
>   1       5
>   5      15
>  15      20
>
> The tables are huge and already in ascending order.

Hi, George.

What conditional logic are you trying to apply?  Union will simply
take the rows from the two tables and combine them.

Sean

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

Предыдущее
От: "Wright, George"
Дата:
Сообщение: table unions
Следующее
От: "Wright, George"
Дата:
Сообщение: Re: table unions