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 1gIJVK-0007Wn-Bn for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 20:23:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIJVH-0003uh-UA for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 20:23:43 +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 1gIJUz-0002JD-Ge for pgsql-general@lists.postgresql.org; Thu, 01 Nov 2018 20:23:25 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIJUw-0002DW-Ea for pgsql-general@postgresql.org; Thu, 01 Nov 2018 20:23:24 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 5DB32992D4 for ; Thu, 1 Nov 2018 13:23:18 -0700 (PDT) Date: Thu, 1 Nov 2018 13:23:18 -0700 (PDT) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@postgresql.org Subject: Add columns to table; insert values based on row Message-ID: User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I have the following code in a script: alter table stations add column start_date date; alter table stations add column end_date date; alter table stations add column howmany integer; alter table stations add column bin_col char(8); insert into stations (start_date, end_date, howmany, bin_col) values ( ) select site_nbr from stations where site_nbr = ' '; The table has 82 rows. Is there a more elegant way to insert data specific to a site_nbr other than 82 repetitions of the insert statement? (I suspect not, but I might be wrong and learn something valuable by asking.) Regards, Rich