Awesome q2a theme
Ask us anything
Toggle navigation
Email or Username
Password
Remember
Login
Register
|
I forgot my password
Questions
Unanswered
Tags
Users
Ask a Question
Mysql update multiple update in one request
0
like
0
dislike
26
views
Hello, I apologize in advance if this question seems childish.
You want to update 5 records in a single table in different rows.
Ie SET filed=1 where id=1, SET filed=2 where id=12, SET filed='0.5' where id=3...
Described as they could. I would be very grateful if will prompt for a path
mysql
asked
Mar 20, 2019
by
Legion
|
26
views
answer
comment
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
2
Answers
0
like
0
dislike
Your decision slow. It is more efficient to update 1 field in 1 regular query, no joins s.
Or use this option, it is much more effective in performance than Yours:
\r
UPDATE `table` SET `field` = CASE `id`
WHEN val1 THEN data1
WHEN val2 THEN data2
ELSE `field` END
\r
Just be sure to do not forget ELSE.
answered
Mar 22, 2019
by
Legion
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
else can
\r
INSERT INTO `table` (id, field) VALUES (1, 1), (2, 12), (3, 0.5) ON DUPLICATE KEY UPDATE field = VALUES(field)
answered
Mar 22, 2019
by
try4tune
ask related question
comment
Please
log in
or
register
to add a comment.
Related questions
0
like
0
dislike
3
answers
How to send multiple queries to MySql database in one get request?
asked
Jun 11, 2019
by
dmitriu256
mysql
node.js
0
like
0
dislike
1
answer
How to update many records in one request?
asked
May 20, 2019
by
Veneomin
mysql
0
like
0
dislike
2
answers
How to update one database with the other obnovlenia having with MySQL?
asked
Apr 20, 2019
by
kissarat
mysql
wordpress
data-transfer
0
like
0
dislike
7
answers
Combine multiple results of a MySQL query into one
asked
Mar 22, 2019
by
Maxima
mysql
0
like
0
dislike
3
answers
Update logic in the age field for the users as of their birthday in MySQL?
asked
Sep 4, 2019
by
ak2ree
mysql
Most popular tags
javascript
php
css
html
jquery
wordpress
python
linux
web-development
mysql
android
windows
java
layout
c#
computer-networks
node.js
cpp
iron
yii
vue.js
1C-Bitrix
react
laravel
django
nginx
system-administration
search-engine-optimization
api
ubuntu
the-it-education.
ajax
sql
programming
hosting
cms
design
apache
google-chrome
bootstrap
Vkontakte
macos
google
network-administration
git
laptops
algorithms
regular-expressions
unity-game-engine
email
angular
database
network-equipment
software
wooŃommerce
debian
.net
ios
information-security
video
law-in-it
browsers
books
parsing
wi-fi
game-development
career
htaccess
postgresql
telegram
mikrotik
mobile-development
ruby-on-rails
the-domain-name-system
modx
Yandex
c
json
opencart
Habr
freelance
vpn
asp.net
windows-server
symfony
bots
hard-drives
math
qt
DIY
audio
frontend
payment-system
bash
electronics
gulp.js
user-interface
docker
online-shopping
110,608
questions
257,187
answers
0
comments
40,796
users