Re: where not exists

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Llew" <postgres(at)lg(dot)ndirect(dot)co(dot)uk>, pgsql-sql(at)postgresql(dot)org
Subject: Re: where not exists
Date: 2002-03-06 20:25:30
Message-ID: web-819049@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2002-03-06 20:29:33 Re: where not exists
Previous Message Josh Berkus 2002-03-06 20:19:03 Fun with SQL