sql 将查询结果插入已存在表

insert into  #check_wl
select t1.FItemID PId,t2.FItemID,t2.FQty 
from ICBOM t1 left join ICBOMCHILD t2 on t1.FInterID =t2.FInterID where  and FUseStatus=1072 and t2.FItemID>0
union all
select  t1.FItemID PId,t2.FItemID ,t2.FQty    from ICBOM t1 left join ICBOMCHILD t2 on t1.FInterID =t2.FInterID 
where  and FUseStatus=1072 and t2.FItemID>0

union all:并联的两个查询的字段数必须一致

insert into 已存在表名
select * from tablea
union all
select * from tableb

1、本站目前拥有近 1000+ 精品收费资源,现在加入VIP会员即可全部下载。
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
SEA模板网 » sql 将查询结果插入已存在表

发表评论

加入本站VIP会员订阅计划,海量资源免费查看

目前为止共有 3654 位优秀的VIP会员加入! 立刻加入VIP会员