代码之家  ›  专栏  ›  技术社区  ›  shamim

如何在SSI中产生交集和除外结果

  •  3
  • shamim  · 技术社区  · 8 年前

    有两个结果集A和B,在SSIS Merge Join中如何获取结果集的EXCEPT和INTERSECT。

    enter image description here

    下面的sql语法返回所需的输出:

    ---Insersect
    select a.* from A a Inner join B b on a.Key=b.Key 
    
    --Except
    select a.* from A a left join B b on a.Key=b.Key where b.Key is null
    

    如何从SSIS合并联接获取这些查询结果

    1 回复  |  直到 8 年前
        1
  •  3
  •   Hadi    4 年前

    根据他的 Microsoft Article , 合并联接转换提供一个输出,该输出是通过使用完整联接、左联接或内部联接联接两个已排序的数据集而生成的

    在“合并联接转换编辑器”(Merge Join Transformation editor)中,可以选择 Join Type 要执行此操作的属性:

    除了:

    在a.Key=B.Key上,从a a左连接B B中选择a*,其中B.Key为null

    你必须设置 联接类型 = Left Outer Join ,并在 Merge Join Transformation 必须添加条件拆分以筛选具有 b.Key is null

    请遵循这篇详细的文章: Get all from Table A that isn't in Table B

    横断

    从a.Key=B.Key上的a a内部连接B B中选择a.*

    你必须设置 联接类型 = Inner Join

    请遵循本文: Inner join in SSIS

    推荐文章