Update multiple rows at one time
See original GitHub issueFeature Description
The Problem
There seems no way to update many rows by one call.
The Solution
Implement a method that to update multiple rows by one call.
For example)
You wanna make a query like below.
UPDATE TOKENS
SET word = (case when id = 1 then 'A'
when id = 2 then 'B'
when id = 3 then 'C'
end)
WHERE id in (1, 2, 3);
And I think It’s not bad to provide the method like this.
const data = [
{
id: 1,
word: 'A'
},
{
id: 2,
word: 'B'
},
{
id: 3,
word: 'C'
}
];
...updateBulkMethod(data);
It’ll must be considered by many aspects.
Considered Alternatives
Implement a method yourself to update multiple rows at one time .
Additional Context
Relevant Database Driver(s)
-
aurora-data-api
-
aurora-data-api-pg
-
better-sqlite3
-
cockroachdb
-
cordova
-
expo
-
mongodb
-
mysql
-
nativescript
-
oracle
-
postgres
-
react-native
-
sap
-
sqlite
-
sqlite-abstract
-
sqljs
-
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time, and I know how to start.
- Yes, I have the time, but I don’t know how to start. I would need guidance.
- No, I don’t have the time, although I believe I could do it if I had the time…
- No, I don’t have the time and I wouldn’t even know how to start.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:19
- Comments:6
Top Results From Across the Web
mysql - SQL - Update multiple records in one query
Try either multi-table update syntax. UPDATE config t1 JOIN config t2 ON t1.config_name = 'name1' AND t2.config_name = 'name2' SET t1.config_value = 'value' ......
Read more >How to Update Multiple Records Using One Query in SQL ...
In SQL, sometimes we need to update multiple records in a single query. We will use the UPDATE keyword to achieve this.
Read more >How to update multiple rows at once in MySQL?
1. You can either write multiple UPDATE queries like this and run them all at once: · 2. Or you can UPDATE with...
Read more >UPDATE multiple rows with different values in one query
Hello, I wanted to know how to UPDATE multiple rows with different values and I just don't get it. For instance, three updates...
Read more >Update multiple rows in SQL with different values at once
Update multiple rows in SQL with different values at once · knex.transaction(function(trx) { · UPDATE users · SELECT 1 as id, 'myFirstName1' as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We would like to see this feature, specifically for postgres. I would be happy to implement it if given some guidance.
It’s ridiculous to find a solution to the same problem for me. Finally, just use Typeform.Repository.save(Entity[]) is perfect to solve.