Re: How to add column from old_table to new_table?

From: Gnanavel S <s(dot)gnanavel(at)gmail(dot)com>
To: Joost Kraaijeveld <J(dot)Kraaijeveld(at)askesis(dot)nl>
Cc: Pgsql-sql(at)postgresql(dot)org
Subject: Re: How to add column from old_table to new_table?
Date: 2005-09-21 13:01:59
Message-ID: eec3b03c0509210601621958ac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 9/21/05, Joost Kraaijeveld <J(dot)Kraaijeveld(at)askesis(dot)nl> wrote:
>
> Hi,
>
> I made a mistake in describing the query I tried. The query I tried was:
>
> update new_table
> set new_attribute = (select old_attribute from old_table, new_table
> where old_table.id = new_table.id)
> where old_table.id = new_table.id

It should be written has

update new_table set new_attribute=old_attribute from old_table where
old_table.id=new_table.id;

It actually returns the error "ERROR: more than one row returned by a
> subquery used as an expression" if ran.
>
>
> --
> Groeten,
>
> Joost Kraaijeveld
> Askesis B.V.
> Molukkenstraat 14
> 6524NB Nijmegen
> tel: 024-3888063 / 06-51855277
> fax: 024-3608416
> e-mail: J(dot)Kraaijeveld(at)Askesis(dot)nl
> web: www.askesis.nl <http://www.askesis.nl>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

--
with regards,
S.Gnanavel
Satyam Computer Services Ltd.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Leif B. Kristensen 2005-09-21 13:06:42 Re: How to add column from old_table to new_table?
Previous Message Gnanavel S 2005-09-21 12:59:11 Re: How to add column from old_table to new_table?