Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIK1e-0000Z2-Cm for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 20:57:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIK1c-0006qb-QB for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 20:57:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIK1c-0006qU-IH for pgsql-general@lists.postgresql.org; Thu, 01 Nov 2018 20:57:08 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIK1Z-00030k-FK for pgsql-general@postgresql.org; Thu, 01 Nov 2018 20:57:08 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 9015A21B81; Thu, 1 Nov 2018 16:57:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 01 Nov 2018 16:57:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=q yw2s5Hz5WFwr7/mEuh63qjftikIHpo9v50eRXgnkVo=; b=q5IneUywaydsZGKtl kurYmSl2Vf6Q9Iaej0dsI0Fd8SrQCeIaIYY5ChiJY6z3KpmiLFmuf0bHp5JuBrWV 0dN5UXRk2IK13Yo+heGaR1NsUcSGYu2OHlCThdJa9Wn6iQ4971y7t9sYpUDVIf56 W7D5niQQK/4jH27vQwJQOzxr7JZ+CXxsSyv6qiYYWyp4DuWSTra5zvf8w5TPMqUz 16g4XysPG9xn4iBUIndaDw9Kn0ONzSfQ50awXWGX2+0ux/aKMszlX+2sCzjT8lC3 k1Lo6nTiz3gQFJ+xWw9ykAeVL6zuM/QXIs5s24iPcttkVoSWv75ZpWgMbb6fiJ0M zGRTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=qyw2s5Hz5WFwr7/mEuh63qjftikIHpo9v50eRXgnk Vo=; b=LthKWH4TcoIJ9xoH32yyMbizBlSNcgs8EX84oVSFi8bKEHDsThKuAYcYM feGCUu/THke4/vu64+ef2B6FzMlJMzXTzAWWZN0Qw94o17ZEiz4zek3hrYnHtdN4 95Ef+PEj+MUCATPhavgm/1dExugssJcV8O6TgQM407RedpoqsrthW4clQJYem2VD 2tbjdPq7DGP3ZapqqYXqpAo2ty1JHnHrt5ZcWWCItOhl0w9PnXMhJilf5o5JBvfu qy5a+EJ4oDfuWK21h0lmOPzis5L9oMgNUJN/ANxqehBze4fjim64bvlaSHNoq6qO QIQ6hlhDKdOvQMrnDzRJrIVPcTIzQ== X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id A58A1102DE; Thu, 1 Nov 2018 16:57:02 -0400 (EDT) Subject: Re: Add columns to table; insert values based on row To: Rich Shepard , pgsql-general References: From: Adrian Klaver Message-ID: <9acea769-2a99-69a2-beaf-d84834a242b0@aklaver.com> Date: Thu, 1 Nov 2018 13:57:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/1/18 1:53 PM, Rich Shepard wrote: > On Thu, 1 Nov 2018, David G. Johnston wrote: > >> That makes no sense to me...you already have 82 rows on the table so >> if you >> insert 82 more you'll have 164 which doesn't seem like what you would >> want... >> >> I would probably do: > > David, > >   The table already exists with four attribute columns and their data. I'm > adding four new columns and their data base on the existing row's value in > column site_nbr. > >   Based on your and Adrian's responses I'll go ahead and enter the values > filled intert statements for each row. Why? As David said that will get you an additional 82 rows with data that is dissociated from the existing data. You want to update the existing rows with the new field data for each station. > > Thanks, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com