Home > Database > Mysql Tutorial > mysql 批量更新记录

mysql 批量更新记录

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 14:58:16
Original
1043 people have browsed it

replaceinto或者insertinto...onduplicatekeyupdate 可以批量更新 但是replace实际是先delete再insert,自动增长ID会变 所以建议用insertinto...onduplicatekeyupdate 无 INSERT INTO tt(id,age) VALUES (48,1),(50,2),(69,2) ON DUPLICATE KEY UPDATE age=VA

replace into 或者insert into ...on duplicate key update
可以批量更新
但是replace 实际是先delete再insert ,自动增长ID会变
所以建议用insert into ...on duplicate key update
INSERT INTO tt(id,age) VALUES  (48,1),(50,2),(69,2) ON DUPLICATE KEY UPDATE age=VALUES(age);
Copy after login
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template