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 1s8jzS-00EyKV-KI for pgsql-general@arkaria.postgresql.org; Sun, 19 May 2024 17:06:32 +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 1s8jzS-00DSvL-FW for pgsql-general@arkaria.postgresql.org; Sun, 19 May 2024 17:06:30 +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 1s8jzS-00DSvC-2z for pgsql-general@lists.postgresql.org; Sun, 19 May 2024 17:06:30 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s8jzL-0013di-H9 for pgsql-general@lists.postgresql.org; Sun, 19 May 2024 17:06:29 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2e538a264f7so28136761fa.0 for ; Sun, 19 May 2024 10:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716138383; x=1716743183; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=STL6ziylA9TF16Ap+QMm3XmPIDDyTlptRIiVaOE6RMc=; b=RUPteA12WI8FeORNsb86+5k72CPpByRv9+LUUKmqGFiCBBf2G1J220INYmD09lbAkc VhqI7F1aeZXVBuxS69jR7bmdHWcDh3Q7/4QOrFZuYmq+5LJzkAPaEYezlRx7jqcGmDZB CtscWzJXTBx2Vr78k2UEvAmdj6Ve2S9Ng4tBwpX3E4ynka4BpG8Yq/JRGHxWnKlqCjnq 6R6UEfjDubTCK3a1YSsExnd7nvKK1R5xmA7Zv1axrX9P3YWqhnttm+a6XENMPKabD4SI Aju0YdiJOa9XQWy+0hG2d7hrmRg+NkkHtsZz1CmcAbebcbynS/t4ywzbaU1noHg1IY9B M55Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716138383; x=1716743183; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=STL6ziylA9TF16Ap+QMm3XmPIDDyTlptRIiVaOE6RMc=; b=HN1XcY0TISIS/Qb0QAv2cSrzLlp7szeXu8QuC5w3TK7rUYCCA5Ba1v1CSw8ePn6oEd /bTtsk0W/tIFYyUJYJhlq0FPIhQonruDx3bn/Nz2phW2y/w+DbVaaV0Rf4/0EooxbIpv DCt8QQUP6nMu33AMrTGqMnRS02GO0+AldgHRbo1k8k3UaE2LiJlgfw0N6zYJ92NwnnNg IWcHwhF4WExM6Qq8O75LF7kd35RFuL+yZWgqVJgHkVAQ6gFWtyWp/pQwEqaT5JPBjEZT CjoYQv4RmpJsHxJ6Ga2ImdfA4H9VNiO7LAda5gZ8Mo2aZesxbBc9ZT7Lz5WuuAtH2Dg8 Wtcg== X-Gm-Message-State: AOJu0YyBCfk9SqZ90UAaLGNVnio2qhtoKQpfOfZS6d5amXuvYcoxaMwh ur3SOwGBQNkYEDT72zHshzN7DA8H4J8xKMQqCoLenlB7YOfLWx5peWL0FyG0CeSU3vkyE0d4b1v 6aFAPJruMymneNo1Woqh+zkPKeB3MkpsA X-Google-Smtp-Source: AGHT+IEPjV+xqrmClUcUN5eF6vMPbIS8CzbE6AcuaMCIpJv5DU2U38IZKrZDLKtPJy8vILQK5PAIYUNyqv6+UT1mcms= X-Received: by 2002:a05:651c:1542:b0:2de:7046:b8f8 with SMTP id 38308e7fff4ca-2e51fd2e6a8mr275183551fa.5.1716138382852; Sun, 19 May 2024 10:06:22 -0700 (PDT) MIME-Version: 1.0 References: <164b3681-7a42-1e5-6a7b-80196ed33ded@appl-ecosys.com> In-Reply-To: <164b3681-7a42-1e5-6a7b-80196ed33ded@appl-ecosys.com> From: Muhammad Ikram Date: Sun, 19 May 2024 22:06:04 +0500 Message-ID: Subject: Re: Updating 457 rows in a table To: Rich Shepard Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000b20abf0618d19a5b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b20abf0618d19a5b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Rich, Based on what I could understand is, here is an example UPDATE employees SET salary =3D salary + 500 WHERE department_id =3D 'Sales'; Sorry, if I misunderstood your question. Regards, Muhammad Ikram Bitnine On Sun, May 19, 2024 at 9:54=E2=80=AFPM Rich Shepard wrote: > 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 > > > > --=20 Muhammad Ikram --000000000000b20abf0618d19a5b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Rich,

Based on what I cou= ld understand is, here is an example

UPDATE employ= ees
SET=C2=A0 salary =3D salary + 500
WHERE department_= id =3D 'Sales';

Sorry, if I misunderstood = your question.

Regards,
Muhammad Ikram
Bitnine



--
Muhammad Ikram

--000000000000b20abf0618d19a5b--