Skip site navigation (1) Skip section navigation (2)


From: Ragnar <gnari(at)hive(dot)is>
To: felix(at)crowfix(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: DELETE with JOIN
Date: 2008-08-07 17:05:38
Message-ID: 1218128738.10575.15.camel@localhost.localdomain (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
On fim, 2008-08-07 at 09:14 -0700, felix(at)crowfix(dot)com wrote:
> I want to delete with a join condition.  Google shows this is a common
> problem, but the only solutions are either for MySQL or they don't
> work in my situation because there are too many rows selected.  I also
> have to make this work on several databases, includeing, grrr, Oracle,
> so non-standard MySQL "solutions" are doubly aggravating.
>     DELETE FROM a WHERE a.b_id = AND b.second_id = ?
> I have tried to do this before and always found a way, usually
>     DELETE FROM a WHERE a.b_id IN (SELECT id FROM b WHERE second_id = ?)

did you look at DELETE FROM table1 USING table2 WHERE ... ?


In response to


pgsql-sql by date

Next:From: Picavet VincentDate: 2008-08-07 17:31:16
Subject: enumerate groups given a certain value
Previous:From: felixDate: 2008-08-07 16:14:49
Subject: DELETE with JOIN

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group