Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8joC-00ExKV-VA for pgsql-general@arkaria.postgresql.org; Sun, 19 May 2024 16:54:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s8joB-00DIaC-P4 for pgsql-general@arkaria.postgresql.org; Sun, 19 May 2024 16:54:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8joB-00DIa2-ED for pgsql-general@lists.postgresql.org; Sun, 19 May 2024 16:54:51 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8jo8-0013YK-49 for pgsql-general@lists.postgresql.org; Sun, 19 May 2024 16:54:50 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 4D48D2A43CF for ; Sun, 19 May 2024 09:54:46 -0700 (PDT) Date: Sun, 19 May 2024 09:54:46 -0700 (PDT) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Updating 457 rows in a table Message-ID: <164b3681-7a42-1e5-6a7b-80196ed33ded@appl-ecosys.com> 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: Archived-At: Precedence: bulk Searching the postgresql doc for UPDATE the examples I find show updating one or a few rows in a table. I have 457 rows to update in a table. I could write a .sql script with 457 lines, each updating one row of the table. My web search for `sql: update table rows from a file of column values' finds pages for single row updates and updating a table from another table, but neither is what I want. I want to change a column value in a table based on the value of a different column in that same table. Specifically, in the 'people' table I want to change the column 'active' from false to true for 457 specific person_id row numbers. Is there a way to do this without manually writing 457 'update ...' rows in a .sql file? TIA, Rich