SQL SERVER UNION和UNION ALL

union与union all
union 缺省在合并结果集后消除重复项,
union all 指定在合并结果集后保留重复项,
打个比喻吧 比如A表的数据是 A{ 1,4,5,9}       B{2,3,4,5}
那我执行此语句 select * from A union select * from B 那结果是{1,2,3,4,5,9}
如果执行select * from A union all select * from B 结果是{1,2,3,4,4,5,5,9}

原文地址:https://www.cnblogs.com/minotmin/p/3513209.html