X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C28DD5E40BA for ; Thu, 19 Aug 2004 19:40:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14274-03 for ; Thu, 19 Aug 2004 22:40:14 +0000 (GMT) Received: from hotmail.com (bay1-f34.bay1.hotmail.com [65.54.245.34]) by svr1.postgresql.org (Postfix) with ESMTP id 1DCFD5E46D3 for ; Thu, 19 Aug 2004 19:40:12 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 19 Aug 2004 15:00:56 -0700 Received: from 65.67.51.65 by by1fd.bay1.hotmail.msn.com with HTTP; Thu, 19 Aug 2004 22:00:56 GMT X-Originating-IP: [65.67.51.65] X-Originating-Email: [gnalesad@hotmail.com] X-Sender: gnalesad@hotmail.com From: "Tony Yang" To: pgsql-sql@postgresql.org Subject: help with scheme changes to live system. Date: Thu, 19 Aug 2004 22:00:56 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 19 Aug 2004 22:00:56.0990 (UTC) FILETIME=[01372BE0:01C48638] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/271 X-Sequence-Number: 18768 Hi Gurus, Please forgive this naive question: Say, I have a table (containerId, itemId) where for each containerId there are several rows (different itemId value) in that table. Now I want to give those rows (with same containerId) a sequence, so add one colum there to make it become (containerId, itemId, sequence); how do I make such changes through SQL? I know how to alter the table to insert that new column, but how do I populate the existed rows on that new column? note the sequence dose not need to confirm to any sorting of other columns, i.e., as long as there is a sequence is ok. for example, if I already have : containerId | itemId | 1 1001 1 1002 1 1003 2 2001 2 2002 then either containerId | itemId | sequence 1 1001 0 1 1002 1 1 1003 2 2 2001 1 2 2002 0 or containerId | itemId | sequence 1 1001 2 1 1002 1 1 1003 0 2 2001 0 2 2002 1 are all OK. Thanks, Gnale _________________________________________________________________ Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963