pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryce Nesbitt <bryce1@obviously.com>
To: pgsql-sql@postgresql.org
Subject: How to copy data between joined columns?
Date: Fri, 07 Apr 2006 13:32:22 -0700
Message-ID: <4436CC56.3040707@obviously.com> (raw)

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.

                   -Bryce Nesbitt
                  

-- 
----
Visit http://www.obviously.com/




view thread (5+ messages)  latest in thread

Message-ID: <4436CC56.3040707@obviously.com>
Permalink:  ../4436CC56.3040707@obviously.com/
Also on:    postgresql.org/message-id/4436CC56.3040707@obviously.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bryce1@obviously.com
  Subject: Re: How to copy data between joined columns?
  In-Reply-To: <4436CC56.3040707@obviously.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox