help with "delete joins"

Поиск
Список
Период
Сортировка
От Robert Treat
Тема help with "delete joins"
Дата
Msg-id 1057011998.24310.348.camel@camel
обсуждение исходный текст
Ответы Re: help with "delete joins"  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: help with "delete joins"  (Robert Treat <xzilla@users.sourceforge.net>)
Re: help with "delete joins"  (Josh Berkus <josh@agliodbs.com>)
Re: help with "delete joins"  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-sql
create table foo (a int, b int, c int, d text);

create table bar (a int, b int, c int);

insert into foo values (1,2,3,'a');
insert into foo values (1,2,4,'A');
insert into foo values (4,5,6,'b');
insert into foo values (7,8,9,'c');
insert into foo values (10,11,12,'d');

insert into bar values (1,2,3);
insert into bar values (7,8,9);
insert into bar values (10,11,12);

what i want to do is:

delete * from foo where not (foo.a = bar.a and foo.b=bar.b and
foo.c=bar.c) ;

so i end up with 

postgres=# select * from foo; a | b | c | d 
---+---+---+---1 | 2 | 4 | A4 | 5 | 6 | b
(2 rows)

but thats not valid sql, is there some way to accomplish this? 

Robert Treat



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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: cleaning up useless pl/pgsql functions
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: help with "delete joins"