Re: DELETE - Mailing list pgsql-general

From Bill Reynolds
Subject Re: DELETE
Date
Msg-id 7C0800F63CCF4149AC0FC5EE2A041226051A7C72@sr002-2k3exc.ateb.com
Whole thread Raw
In response to DELETE  ("c k" <shreeseva.learning@gmail.com>)
List pgsql-general

Add the USING list clause:

 

usinglist

A list of table expressions, allowing columns from other tables to appear in the WHERE condition. This is similar to the list of tables that can be specified in the FROM Clause of a SELECT statement; for example, an alias for the table name can be specified. Do not repeat the target table in the usinglist, unless you wish to set up a self-join.

See this page for more info:

http://www.postgresql.org/docs/8.3/static/sql-delete.html

 

 

So something like this:

delete from ……… using DOCS where ………………

 

 

Full syntax description:

DELETE FROM [ ONLY ] table [ [ AS ] alias ]
    [ USING usinglist ]
    [ WHERE condition | WHERE CURRENT OF cursor_name ]
    [ RETURNING * | output_expression [ AS output_name ] [, ...] ]

 

 


From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of c k
Sent: Tuesday, August 19, 2008 3:04 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] DELETE

 

hello,
what will be the error in syntax of following statement?

delete from accountingtransactions where accountingtransactions.refaccdocid=docs.docid and docs.tmpselect=-1 and docs.tmpselectedby= $1;
when a new function is created it does not gives any error but when this function is called from outside it gives syntax error as 'missing FROM-clause entry for table "docs"'. Why? any clue?

Regards,
CPK

pgsql-general by date:

Previous
From: "c k"
Date:
Subject: DELETE
Next
From: Alvaro Herrera
Date:
Subject: Re: Pg dump Error