| From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
| Cc: | Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: UPDATE with multiple WHERE conditions |
| Date: | 2024-06-13 10:34:25 |
| Message-ID: | 202406131034.pfckaz3va2bb@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 2024-Jun-12, David G. Johnston wrote:
> On Wed, Jun 12, 2024 at 2:28 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
> wrote:
>
> > I have a table with 3492 rows. I want to update a boolean column from
> > 'false' to 'true' for 295 rows based on the value of another column.
>
> I'll often just use a spreadsheet to build the 295 update commands and
> copy-paste them into psql or whatnot.
A closely related technique: if you have a query that generates the
UPDATE commands you need, you can run it under \gexec in psql, and
they'll be executed.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Al principio era UNIX, y UNIX habló y dijo: "Hello world\n".
No dijo "Hello New Jersey\n", ni "Hello USA\n".
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2024-06-13 11:47:57 | Re: Question about UNIX socket connections and SSL |
| Previous Message | Koen De Groote | 2024-06-13 10:01:38 | Re: Questions on logical replication |