table unions - Mailing list pgsql-novice

From Wright, George
Subject table unions
Date
Msg-id 51548D6D5BEB57468163194A8C1A0E980161A35B@MAGPTCPEXC02.na.mag-ias.net
Whole thread Raw
In response to Re: join group by etc  (Peter Jackson <tasmaniac@iprimus.com.au>)
Responses Re: table unions  ("Sean Davis" <sdavis2@mail.nih.gov>)
List pgsql-novice
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.


pgsql-novice by date:

Previous
From: Peter Jackson
Date:
Subject: Re: join group by etc
Next
From: "Sean Davis"
Date:
Subject: Re: table unions