Re: where not exists

From: "Llew" <leo(dot)goodstadt(at)anat(dot)ox(dot)ac(dot)uk>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: where not exists
Date: 2002-03-06 21:14:11
Message-ID: a660r3$1207$1@jupiter.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)agliodbs(dot)com> wrote in message
news:web-819049(at)davinci(dot)ethosmedia(dot)com(dot)(dot)(dot)
> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Greg Sabino Mullane 2002-03-06 22:49:28 Re: \d+ and \dd
Previous Message Thomas Good 2002-03-06 20:56:24 \d+ and \dd