Java教程

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

本文主要是介绍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

这篇关于sql 将查询结果插入已存在表的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!