pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Llew <leo.goodstadt@anat.ox.ac.uk>
To: pgsql-sql@postgresql.org
Subject: Re: where not exists
Date: Wed, 6 Mar 2002 21:14:11 -0000
Message-ID: <a660r3$1207$1@jupiter.hub.org> (raw)
References: <web-819049@davinci.ethosmedia.com>

Dear Josh,
The reason why I do things is two steps is that this allows me archive the
deleted items.
Llew

""Josh Berkus"" <josh@agliodbs.com> wrote in message
news:web-819049@davinci.ethosmedia.com...
> Llew,
>
> Do it all in one query:
>
> > DELETE FROM a
> >         WHERE NOT EXISTS
> >         (
> >             SELECT b.join1
> >                 FROM b
> >                 WHERE
> >                 a.join1 = b.join1 AND
> >                 a.join2 = b.join2
> >         )
>
> And make sure that join1 and join2 are indexed in both tables.
>
> -Josh Berkus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org





view thread (7+ messages)  latest in thread

Message-ID: <a660r3$1207$1@jupiter.hub.org>
Permalink:  ../a660r3$1207$1@jupiter.hub.org/
Also on:    postgresql.org/message-id/a660r3$1207$1@jupiter.hub.org

 · 

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: leo.goodstadt@anat.ox.ac.uk
  Subject: Re: where not exists
  In-Reply-To: <a660r3$1207$1@jupiter.hub.org>

* 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