Re: DELETE

From: "Bill Reynolds" <Bill(dot)Reynolds(at)ateb(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: DELETE
Date: 2008-08-19 19:14:12
Message-ID: 7C0800F63CCF4149AC0FC5EE2A041226051A7C72@sr002-2k3exc.ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
<http://www.postgresql.org/docs/8.3/static/sql-select.html#SQL-FROM> 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(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of c k
Sent: Tuesday, August 19, 2008 3:04 PM
To: pgsql-general(at)postgresql(dot)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

In response to

  • DELETE at 2008-08-19 19:04:00 from c k

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-08-19 19:40:25 Re: Pg dump Error
Previous Message c k 2008-08-19 19:04:00 DELETE