Re: table unions - Mailing list pgsql-novice

From Sean Davis
Subject Re: table unions
Date
Msg-id 264855a00808080849h7f960d5cw3d1a1e57e5881377@mail.gmail.com
Whole thread Raw
In response to table unions  ("Wright, George" <George.Wright@infimatic.com>)
Responses Re: table unions
List 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 by date:

Previous
From: "Wright, George"
Date:
Subject: table unions
Next
From: "Wright, George"
Date:
Subject: Re: table unions