Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: Delete from...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 5 Topic 15953 of 16965
Post > Topic >>

Re: Delete from Join

by tgl@[EMAIL PROTECTED] (Tom Lane) Jul 3, 2008 at 11:29 AM

Gwyneth Morrison <gwynethm@[EMAIL PROTECTED]
> writes:
> What I am actually trying to get past is:

>     DELETE FROM data_table1
>                 using data_table2 INNER JOIN
>                          data_table1  ON data_table1.fkey =
>  data_table2.pkey;

The equivalent to that in Postgres would be

    DELETE FROM data_table1
      USING data_table2
      WHERE data_table1.fkey = data_table2.pkey;

The fundamental issue here is that MSSQL expects the USING clause to
contain a second reference to the delete target table, whereas PG
does not --- if you write the table name again, that's effectively
a self-join and you probably won't get the behavior you want.

You can use JOIN syntax in USING in Postgres, but only for situations
where the query really involves three or more tables.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 5 Posts in Topic:
Re: Delete from Join
gwynethm@[EMAIL PROTECTED  2008-07-02 15:12:59 
Re: Delete from Join
gwynethm@[EMAIL PROTECTED  2008-07-03 08:26:52 
Re: Delete from Join
tgl@[EMAIL PROTECTED] (T  2008-07-03 11:29:46 
Re: Delete from Join
lennin.caro@[EMAIL PROTEC  2008-07-03 06:28:38 
Re: Delete from Join
gwynethm@[EMAIL PROTECTED  2008-07-04 10:00:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 7:53:36 CDT 2008.