Access - SELECT JOIN many to many 2 tables with 3 字典

Access - SELECT JOIN many to many 2 tables with 3 dictionaries

请帮助我进行 ACCESS SQL SELECT 查询。

Database scheme

我需要 link 销售数据到我的促销 table。请参阅上面的方案。 我尝试过这样的想法,但它不起作用。

       SELECT P.Ext_item_id, P.Ext_shop_id, P.Ext_date_id, S.SALES

       FROM (((PromoTable AS P INNER JOIN SHOP AS SH ON P.Ext_shop_id = SH.Ext_shop_id)
                               INNER JOIN ITEM AS I ON P.Ext_item_id = I.Ext_item_id)
                               INNER JOIN DATE AS D ON P.Ext_date_id = D.Ext_date_id)

                          ?????INNER JOIN SALES AS S ON SH.shop_id=S.shop_id
                                                    AND I.item_id = S.item_id
                                                    AND D.date_id = D.date_id

问题是:如何link 2 tables using 3 dictionary tables beetween (M:M relationship) 非常感谢!

table秒

中的数据示例

Tables view

你最初的做法似乎是正确的..

  SELECT P.Ext_item_id, P.Ext_shop_id, P.Ext_date_id, S.SALES
  FROM PROMO P
  INNER JOIN SHOP SH ON P.Ext_shop_id = SH.Ext_shop_id
  INNER JOIN ITEM I ON P.Ext_item_id = I.Ext_item_id
  INNER JOIN [DATE] D ON P.Ext_date_id = D.Ext_date_id
  INNER JOIN SALES S 
    ON SH.shop_id=S.shop_id  AND I.item_id = S.item_id  AND D.date_id = S.date_id