pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Treat <rtreat@webmd.net>
To: pgsql-sql@postgresql.org
Subject: help with "delete joins"
Date: 30 Jun 2003 18:26:38 -0400
Message-ID: <1057011998.24310.348.camel@camel> (raw)

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




view thread (6+ messages)  latest in thread

Message-ID: <1057011998.24310.348.camel@camel>
Permalink:  ../1057011998.24310.348.camel@camel/
Also on:    postgresql.org/message-id/1057011998.24310.348.camel@camel

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rtreat@webmd.net
  Subject: Re: help with "delete joins"
  In-Reply-To: <1057011998.24310.348.camel@camel>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox