On Mon, 20 May 2024, Alban Hertroys wrote:
That aside, while you’re not absolutely 100% definitely sure that an
UPDATE or DELETE statement is going to do exactly what you intended, and
for good measure if you are, wrapping such statements in a transaction
allows you to ROLLBACK to get back to th
> On 19 May 2024, at 20:37, Rich Shepard wrote:
>
> On Sun, 19 May 2024, Christophe Pettus wrote:
>
>> Of course, you can probably also shorten the query to:
>>
>> UPDATE people SET active=true WHERE ...
>>
>> Where ... is the predicate you would have used in the SELECT id WHERE ...
>
> Ah,
On Sun, 19 May 2024, Christophe Pettus wrote:
Of course, you can probably also shorten the query to:
UPDATE people SET active=true WHERE ...
Where ... is the predicate you would have used in the SELECT id WHERE ...
Ah, yes. Hadn't thought of that. The statement would be
UPDAT
On Sun, 19 May 2024, Muhammad Salahuddin Manzoor wrote:
I think triggers are a good option.
Salahuddin,
I need to update the table with all the designated rows only once. But, I'll
look at using triggers.
Thanks,
Rich
> On May 19, 2024, at 11:30, Rich Shepard wrote:
> That's a good idea; I can use a predicate to identify the rows to update.
> That would be shorter than a long, comma-separated list.
Of course, you can probably also shorten the query to:
UPDATE people SET active=true WHERE ...
Where
On Sun, 19 May 2024, Ray O'Donnell wrote:
Could you create a table with just person_id values whose rows are to be
updated? Then you could do something like this:
update people set active = true where exists (
select 1 from temporary_table where person_id = people.person_id
);
That's just o
On Sun, 19 May 2024, Christophe Pettus wrote:
UPDATE people SET active=true WHERE id IN (...);
The ... can either be an explicit list of the ids, or a SELECT id WHERE if
you have a predicate that selects the appropriate ids.
Christophe,
That's a good idea; I can use a predicate to identify t
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
wrote:
> Searching the postgresql
On 19/05/2024 17:54, 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 ta
> On May 19, 2024, at 09:54, Rich Shepard wrote:
>
> Specifically, in the 'people' table I want to change the column 'active'
> from false to true for 457 specific person_id row numbers.
UPDATE people SET active=true WHERE id IN (...);
The ... can either be an explicit list of the ids, or a
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' fin
11 matches
Mail list logo