Re: [SQL] help with "delete joins"

2003-07-01 Thread Bruno Wolff III
On Mon, Jun 30, 2003 at 18:26:38 -0400, Robert Treat <[EMAIL PROTECTED]> wrote: > 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) ; For the case without not (which appears to be what you really want) you can pretty much do this. See below

Re: [SQL] help with "delete joins"

2003-07-01 Thread Robert Treat
On Mon, 2003-06-30 at 20:35, Josh Berkus wrote: > Robert, > > > 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 | A > > 4 | 5 | 6 | b > > (2

Re: [SQL] help with "delete joins"

2003-06-30 Thread Josh Berkus
Robert, > 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 | A > 4 | 5 | 6 | b > (2 rows) > > but thats not valid sql, is there some way to accomplish this?

Re: [SQL] help with "delete joins"

2003-06-30 Thread Robert Treat
On Mon, 2003-06-30 at 18:26, Robert Treat wrote: > 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');

Re: [SQL] help with "delete joins"

2003-06-30 Thread Stephan Szabo
On 30 Jun 2003, Robert Treat wrote: > 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

[SQL] help with "delete joins"

2003-06-30 Thread Robert Treat
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