Re: where not exists - Mailing list pgsql-sql

From Josh Berkus
Subject Re: where not exists
Date
Msg-id web-819049@davinci.ethosmedia.com
Whole thread Raw
In response to where not exists  ("Llew" <postgres@lg.ndirect.co.uk>)
Responses \d+ and \dd  (Thomas Good <tomg@admin.nrnet.org>)
List 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


pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Fun with SQL
Next
From: Thomas Good
Date:
Subject: \d+ and \dd