Search Postgresql Archives

Re: Delete from Join

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





--- On Wed, 7/2/08, Gwyneth Morrison <postgres@xxxxxxxxxxx> wrote:

> From: Gwyneth Morrison <postgres@xxxxxxxxxxx>
> Subject: [GENERAL] Delete from Join
> To: pgsql-general@xxxxxxxxxxxxxx
> 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))


      



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux