Re: Question About UNION

Поиск
Список
Период
Сортировка
От Bill Thoen
Тема Re: Question About UNION
Дата
Msg-id 48EE6047.8070904@gisnet.com
обсуждение исходный текст
Ответ на Question About UNION  (Bill Thoen <bthoen@gisnet.com>)
Список pgsql-general
David Wilson wrote:
> On Thu, Oct 9, 2008 at 3:31 PM, Bill Thoen <bthoen@gisnet.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. :)
>
I'm sorry, you had it right the first time. Here's a script that
verifies it:

create table table1 (
   a integer,
   b integer,
   c char(1)
);

insert into table1 values ( 1, 12, 'A');
insert into table1 values ( 2, 16, 'B');
insert into table1 values ( 8,  6, 'A');
insert into table1 values (19,  9, 'C');
insert into table1 values (20, 12, 'A');

create table table2 (
   a integer,
   b integer,
   c char(1)
);

insert into table2 values ( 1, 13, 'D');
insert into table2 values ( 2, 16, 'B');
insert into table2 values ( 8,  6, 'B');
insert into table2 values (12,  5, 'A');

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

drop table table1;
drop table table2;


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

Предыдущее
От: Bill Thoen
Дата:
Сообщение: Re: Question About UNION
Следующее
От: Raymond O'Donnell
Дата:
Сообщение: Fwd: Set-valued function in wrong context