X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6A6AA310ACA for ; Mon, 30 Jun 2003 22:26:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 04899-03 for ; Mon, 30 Jun 2003 19:26:42 -0300 (ADT) Received: from localhost.localdomain (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id A587E310ABB for ; Mon, 30 Jun 2003 19:26:41 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h5UNOR4i015358 for ; Mon, 30 Jun 2003 19:24:29 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h5UMQcZ06106 for ; Mon, 30 Jun 2003 18:26:39 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id MTKBPRL9; Mon, 30 Jun 2003 18:26:38 -0400 Subject: help with "delete joins" From: Robert Treat To: pgsql-sql@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 30 Jun 2003 18:26:38 -0400 Message-Id: <1057011998.24310.348.camel@camel> Mime-Version: 1.0 X-Archive-Number: 200306/349 X-Sequence-Number: 14107 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 | A 4 | 5 | 6 | b (2 rows) but thats not valid sql, is there some way to accomplish this? Robert Treat