1.union是A集合和B集合的并集;
select 'S_E_Product' FormType,Name,Code,Version,ProjectInfoID,WBSID,MajorValue from S_E_Product where ID='ac130126-8cf2-48e5-8584-f1c737dd3678'
union
select 'S_E_ProductVersion' FormType,Name,Code,Version,ProjectInfoID,WBSID,MajorValue from S_E_ProductVersion where
ProductID='ac130126-8cf2-48e5-8584-f1c737dd3678'
2.intersect是A集合和B集合的交集;
select Name,Code,Version,ProjectInfoID,WBSID,MajorValue from S_E_Product where ID='ac130126-8cf2-48e5-8584-f1c737dd3678'
intersect
select Name,Code,Version,ProjectInfoID,WBSID,MajorValue from S_E_ProductVersion where
ProductID='ac130126-8cf2-48e5-8584-f1c737dd3678'
3.except是A集合减去B集合的结果;
select Name,Code,Version,ProjectInfoID,WBSID,MajorValue from S_E_ProductVersion where
ProductID='ac130126-8cf2-48e5-8584-f1c737dd3678'
except
select Name,Code,Version,ProjectInfoID,WBSID,MajorValue from S_E_Product where ID='ac130126-8cf2-48e5-8584-f1c737dd3678'
注:都是返回的是非重复值,联合查询的表字段必须一致。