From: | Muhammad Ikram <mmikram(at)gmail(dot)com> |
---|---|
To: | Rich Shepard <rshepard(at)appl-ecosys(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Updating 457 rows in a table |
Date: | 2024-05-19 17:06:04 |
Message-ID: | CAGeimVoWSRvrE4M1ppxVAkAvoFr=XXKT8NQu1dftKFnx7V45MA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Rich,
Based on what I could understand is, here is an example
UPDATE employees
SET salary = salary + 500
WHERE department_id = 'Sales';
Sorry, if I misunderstood your question.
Regards,
Muhammad Ikram
Bitnine
On Sun, May 19, 2024 at 9:54 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
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
>
>
>
>
--
Muhammad Ikram
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2024-05-19 18:30:30 | Re: Updating 457 rows in a table |
Previous Message | Ray O'Donnell | 2024-05-19 16:57:41 | Re: Updating 457 rows in a table |