X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CFC0B11F6600 for ; Fri, 7 Apr 2006 17:32:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37135-01 for ; Fri, 7 Apr 2006 17:32:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from outbound7.internet-mail-service.net (outbound7.internet-mail-service.net [216.240.47.198]) by postgresql.org (Postfix) with ESMTP id 1F7AF11F61E0 for ; Fri, 7 Apr 2006 17:32:31 -0300 (ADT) Received: from idiom.com (idiom.com [216.240.32.1]) by outbound.internet-mail-service.net (Postfix) with ESMTP id 4695A245FC6 for ; Fri, 7 Apr 2006 13:32:31 -0700 (PDT) Received: from [192.168.1.109] (adsl-69-107-132-69.dsl.pltn13.pacbell.net [69.107.132.69]) by idiom.com (8.12.11/8.12.11) with ESMTP id k37KWUjT064647 for ; Fri, 7 Apr 2006 13:32:30 -0700 (PDT) (envelope-from bryce1@obviously.com) Message-ID: <4436CC56.3040707@obviously.com> Date: Fri, 07 Apr 2006 13:32:22 -0700 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050921 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: How to copy data between joined columns? Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200604/53 X-Sequence-Number: 24862 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/