
如何实现一条sql语句插入多行数据
展开全部
2种方案
1)
insert into tab1(fld1, fld2....fldn)
SELECT field1, field2....fieldn fom tab2 where xxxxx
2) insert into tab1(fld1, fld2....fldn) VALUES(1, 11, ....1111), (2, 22, ..., 2222), .....,(n, nn,...., nnnn)
1)
insert into tab1(fld1, fld2....fldn)
SELECT field1, field2....fieldn fom tab2 where xxxxx
2) insert into tab1(fld1, fld2....fldn) VALUES(1, 11, ....1111), (2, 22, ..., 2222), .....,(n, nn,...., nnnn)
展开全部
insert into tb (a,b,c,d)
select * from tbx where a<10
如果都是值也可以
insert into tb(a,b,c)
select 'a','b','c' union
select 'd','e','f' union
select 'x','y','z'
上面是三行数据
select * from tbx where a<10
如果都是值也可以
insert into tb(a,b,c)
select 'a','b','c' union
select 'd','e','f' union
select 'x','y','z'
上面是三行数据
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
insert into table_A
select * from table_B
注意:表a,b栏位数量和值类型要对应
select * from table_B
注意:表a,b栏位数量和值类型要对应
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询