Re: Question About UNION

From: "David Wilson" <david(dot)t(dot)wilson(at)gmail(dot)com>
To: "Bill Thoen" <bthoen(at)gisnet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question About UNION
Date: 2008-10-09 19:35:32
Message-ID: e7f9235d0810091235s84723a5x91e5bb6a492d26b4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 9, 2008 at 3:31 PM, Bill Thoen <bthoen(at)gisnet(dot)com> wrote:

> Thanks, but that didn't work. That selected only the records from table1.

That's why I warned you about it being written in gmail. :)

select * from table1
union
select table2.* from table2 left join table1 on table2.a=table1.a and
table2.b=table1.b where table1.a is null;

This should probably do it without the temp table (the first version
was checking for null in the wrong place).
--
- David T. Wilson
david(dot)t(dot)wilson(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Thoen 2008-10-09 19:49:27 Re: Question About UNION
Previous Message Bill Thoen 2008-10-09 19:31:39 Re: Question About UNION