之前听说union与union all在并库时会有“是”与“否”去重的区别,之前一直没有关注到,直接在一次审计中提交工作结果时,与接受方核对数据出现差异,才深刻理解这一区别。这一刻我记住了!
select * from (
select "银行存款" as 来源,* from [银行存款$] union all
select "中电科技往来" as 来源,* from [中电科技往来$] union all
select "中电科技深圳分公司往来" as 来源,* from [中电科技深圳分公司往来$] union all
select "杭州往来" as 来源,* from [杭州往来$] union all
select "以前年度拓展" as 来源,* from [以前年度拓展$])a,
[名称$] b
where a.小项=b.小项