From: | Troy Campano <troycampano(at)yahoo(dot)com> |
---|---|
To: | "Hought, Todd" <Todd(dot)Hought(at)echostar(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: how to merge a table from another DB |
Date: | 2004-02-17 23:59:07 |
Message-ID: | 1077062347.6938.3.camel@floweria.troygeek.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Could you do...
UPDATE mytable SET mycolumn =
(
SELECT myothercolumn
FROM myothertable
WHERE myothertable.primarykey = mytable.primarykey
)
Not sure how this works in PostgreSQL, but I do it all the time in
Oracle (note only one table definition in subselect)
thanks!
~ Troy Campano ~
On Tue, 2004-02-17 at 13:55, Hought, Todd wrote:
> I have a bit of a dilemma, I'm fairly new to PG, and not quite sure how
> to do this:
> I have a DB that has been basically 'forked' - a copy of the original
> was made for a handful of users to play with without messing with the
> live DB. Now, they would like to know if the changes they have made to
> the forked db can be merged back in to the live one. A change to one
> column of every row in a certain table. How can I update just that field
> in every row of the db without harming the existing data already in that
> table?
>
> thanks in advance.
>
> -Todd
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-02-18 00:13:05 | Re: String manipulation |
Previous Message | Bruce Momjian | 2004-02-17 23:42:20 | Re: String manipulation |