From: | Lennin Caro <lennin(dot)caro(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org, Gwyneth Morrison <postgres(at)toadware(dot)ca> |
Subject: | Re: Delete from Join |
Date: | 2008-07-02 18:04:04 |
Message-ID: | 472021.52409.qm@web59511.mail.ac4.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
--- On Wed, 7/2/08, Gwyneth Morrison <postgres(at)toadware(dot)ca> wrote:
> From: Gwyneth Morrison <postgres(at)toadware(dot)ca>
> Subject: [GENERAL] Delete from Join
> To: pgsql-general(at)postgresql(dot)org
> Date: Wednesday, July 2, 2008, 3:15 PM
> Hello,
>
> Is it possible to use a join keyword in a delete?
>
> For example:
>
> DELETE FROM data_table1
> using data_table2 INNER JOIN
> data_table1 ON data_table1.fkey =
> data_table2.pkey;
>
>
> It is not directly mentioned in the delete syntax but the
> delete refers
> to the select clause where JOIN is valid.
>
> G
>
i have a example
delete from t1 a using t2 b where a.id = b.oid
A standard way to do it is
delete from t1 a where id in (select a.id from t1 a inner join t2 b on (a.id = b.oid))
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-07-02 18:23:37 | Re: Memory use in 8.3 plpgsql with heavy use of xpath() |
Previous Message | Chandra Barnett | 2008-07-02 17:09:49 | Re: Problem with roles and permissions |