求sql怎么一次用insert 添加多条数据

2025-03-25 04:28:00
推荐回答(2个)
回答1:

insert into table(col1, col2, col3...)
select col1, col2, col3...
from tableb
where ...
还可以union all 其他结果集。

回答2:

第一种:
INSERT INTO BillInfo
(BillID
,BID
,IWtime
,Storage)
VALUES
('1',1,'2012-11-19',100)
,('2',1,'2012-11-19',100)
,('3',1,'2012-11-19',100)
,('4',1,'2012-11-19',100)

第二种:
insert xxx(id,name) select id,name from xxx