1

我的物理层有两个表(由于某种原因)虽然我知道最好两个联合两个表。表 A 和表 B 具有相同的结构。我的目标是实现一个类似的 sql:</p>

select F1,F2 
     from (select *
           from tableA
           union
           select *
           from tableB)
tableMix

只是联合两个因素表......我怎么能在管理工具中做到这一点?

现在像这样的nqquery

WITH SAWITH0 AS
    ((select T3580.AMOUNT as c1, T30887.YEAR_DESC as c2, T30887.YEAR_WID as c3
      from DW_DAY_D T30887 /* A_Dim_DW_TQ_DAY_D */, DW_TQ_PRODUCT_F T3580 /*                    A_Fact_DW_TQ_PRODUCT_F */
      where (T3580.DAY_ID = T30887.DAY_WID)
      union all
      select T120596.AMOUNT   as c1,
      T30887.YEAR_DESC as c2,
      T30887.YEAR_WID  as c3
      from DW_DAY_D T30887 /* A_Dim_DW_TQ_DAY_D */, DW_MHG_PRODUCT_F T120596 /*      A_Fact_DW_MHG_PRODUCT_F */
      where (T30887.DAY_WID = T120596.DAY_ID))),
      SAWITH1 AS
     (select distinct D3.c1 as c1, D3.c2 as c2, D3.c3 as c3 from SAWITH0 D3)
     select distinct 0 as c1, D2.c2 as c2, D2.c1 as c3, D2.c3 as c4
     from SAWITH1 D2
     order by c4, c3

但我不能将聚合规则设置为“金额”上的“总和”。

4

1 回答 1

0

选项 1:您可以在物理层中创建一个不透明的视图。该视图将是您在帖子中提到的查询。

选项2:在BMM层,创建一个逻辑表(tableMix),有两个逻辑表源(tableA和tableB)。

于 2013-02-26T15:06:23.197 回答