Search Postgresql Archives

Re: DELETE

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

 



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@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of c k
Sent: Tuesday, August 19, 2008 3:04 PM
To: pgsql-general@xxxxxxxxxxxxxx
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


[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