How to copy value between tables

Поиск
Список
Период
Сортировка
Искать

How to copy value between tables

От:
Michael Rowan <mike.rowan@internode.on.net>
Дата:
Will the following work?

UPDATE child SET child_name = (SELECT parent_name FROM parent WHERE  
parent_id = child_parent_id) WHERE child_name = 'not known' ;

That is, copy the parent_name into the corresponding child_name if the  
child_name was 'not known'


Michael Rowan
mike.rowan@internode.on.net

11 Kingscote Street
ALBERTON
South Australia 5014

tel 618 8240 3993



Re: How to copy value between tables

От:
"Oliveiros C," <oliveiros.cristina@marktest.pt>
Дата:
Howdy, Michael.

I didnt try your query, but at first glance, it seems OK, why do you ask?

Did you try and it gave u some kind of error?

Best,
Oliveiros

----- Original Message ----- 
From: "Michael Rowan" 
To: "postgresql novice" 
Sent: Wednesday, August 26, 2009 2:40 PM
Subject: [NOVICE] How to copy value between tables


> Will the following work?
> 
> UPDATE child SET child_name = (SELECT parent_name FROM parent WHERE  
> parent_id = child_parent_id) WHERE child_name = 'not known' ;
> 
> That is, copy the parent_name into the corresponding child_name if the  
> child_name was 'not known'
> 
> 
> Michael Rowan
> mike.rowan@internode.on.net
> 
> 11 Kingscote Street
> ALBERTON
> South Australia 5014
> 
> tel 618 8240 3993
> 
> 
> 
> 
> -- 
> Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
FAQ