Re: How to copy data between joined columns? - Mailing list pgsql-sql

From Scott Marlowe
Subject Re: How to copy data between joined columns?
Date
Msg-id 1144442088.32269.31.camel@state.g2switchworks.com
Whole thread Raw
In response to How to copy data between joined columns?  (Bryce Nesbitt <bryce1@obviously.com>)
Responses Re: How to copy data between joined columns?  (Bryce Nesbitt <bryce1@obviously.com>)
List pgsql-sql
On Fri, 2006-04-07 at 15:32, Bryce Nesbitt wrote:
> I have a need to copy/update data from one column to another, based on a
> join condition.  Is this easy to do in pure SQL?  I have google'ed
> without luck for a easy solution (that's not Microsoft specific, that
> is).  For example:
> 
> postgres=#
> select xx_thing.date_start,xx_note.created_date
> from xx_thing
> join xx_issue using (thing_id) join xx_note using (issue_id)
> where xx_note.created_date is not null;
> 
>      date_start     |    created_date
> ----------------+---------------------
>  2006-03-17     | 1900-01-01
> (...many... rows)
> 
> I need to copy date_start to created_date, for all records that meet a
> particular where condition.

If it's for the same rows in the same table, you're overworking it.

update table set field1=field2 where somecondition;


pgsql-sql by date:

Previous
From: Bryce Nesbitt
Date:
Subject: How to copy data between joined columns?
Next
From: Bryce Nesbitt
Date:
Subject: Re: How to copy data between joined columns?