Mysql的批量插入语句怎么写?
比如这条:INSERTINTO`a1`.`tutorial`(`user_id`,`id`,`step`,`complete_time`,`update_time`,`r...
比如这条:
INSERT INTO `a1`.`tutorial` (
`user_id` ,
`id` ,
`step` ,
`complete_time` ,
`update_time` ,
`record_time`
)
VALUES(
'3', '2', '8', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '3', '7', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '4', '11', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '5', '17', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '6', '9', '131477518',
CURRENT_TIMESTAMP , '131477498'
);
我要从user_id=10 一直修改到 user_id=99 每个ID都要插像上面这种的五条数据
不可能一直这样复制黏贴吧..
所以想问问Mysql中有没有循环之类的呀. 展开
INSERT INTO `a1`.`tutorial` (
`user_id` ,
`id` ,
`step` ,
`complete_time` ,
`update_time` ,
`record_time`
)
VALUES(
'3', '2', '8', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '3', '7', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '4', '11', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '5', '17', '131477518',
CURRENT_TIMESTAMP , '131477498'
),(
'3', '6', '9', '131477518',
CURRENT_TIMESTAMP , '131477498'
);
我要从user_id=10 一直修改到 user_id=99 每个ID都要插像上面这种的五条数据
不可能一直这样复制黏贴吧..
所以想问问Mysql中有没有循环之类的呀. 展开
6个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询