Re: where not exists - Mailing list pgsql-sql

From Llew
Subject Re: where not exists
Date
Msg-id a660r3$1207$1@jupiter.hub.org
Whole thread Raw
In response to Re: where not exists  ("Josh Berkus" <josh@agliodbs.com>)
List pgsql-sql
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




pgsql-sql by date:

Previous
From: "Llew"
Date:
Subject: Re: where not exists
Next
From: jmycr@cs.com
Date:
Subject: subquery involving 'now'