Re: Table name specified more than once - Mailing list pgsql-general

From Manfred Koizar
Subject Re: Table name specified more than once
Date
Msg-id fotjevcvhljovir89cnl5mbga5mhr41uir@4ax.com
Whole thread Raw
In response to Table name specified more than once  (Alexander Mueller <Alexander.Mueller@SurfControl.com>)
List pgsql-general
On Fri, 13 Jun 2003 17:07:28 +0200, Alexander Mueller
<Alexander.Mueller@SurfControl.com> wrote:
>It results in a "Table name "Workstations" specified more than once" error
>message. Can anyone help me with correcting the syntax?

Don't include the table you want to update in the FROM list:

    UPDATE onetable
       SET col1 = othertable.cola, col2 = othertable.colb
      FROM othertable
     WHERE onetable.x = othertable.y;

In your case othertable is the subselect and the JOIN condition moves
to the WHERE clause.

>copying, distribution or any action taken or omitted to  be taken in
>reliance on it, is prohibited and may be unlawful.

Am I going to be arrested? :-(

Servus
 Manfred

pgsql-general by date:

Previous
From: Lamar Owen
Date:
Subject: Re: [HACKERS] SAP and MySQL ... [and Benchmark]
Next
From: Ian Barwick
Date:
Subject: Re: How can I insert a UTF-8 character with psql?