6 Replies Latest reply: Jan 5, 2016 4:43 AM by Андрей Шепель RSS

    Joining two tables with similar structure by link table

    Андрей Шепель

      Colleagues, good day!


      Try to describe you my task:


      In my real model i have secondary sales of distributors (Distributor_Id) (sales to real shops). Shops - is DeliveryPoint_Id.

      I need to join for current structure primary sales - sales to distributors.


      The main thing -to save current structure: Table with Secondary sales, LinkTable and Products.

      LinkTable necessarily must have current fields:








      Main link between secondary and primary sales is Warehouse_Id - DeliveryPoint_Id_Primary

      Also primary table has same field Nomenclature_Id and Дата. It's the main promblem to connect correctly it to Secondary sales by LinkTable. I think it must be some auto combine Key link table (WareHouse_Id, Nomenclature_Id, Дата) or some other.

      In real model Warehouse_Id can have two or several same DeliveryPoint_Id_Primary, and reverse situation: DeliveryPoint_Id_Primary can have several same WareHouse_Id, thats why primary sales must not be dublicated.



      In attachment qvd's and test model.

      Also i've attached in excel file test result table with secondary and primary sales.


      Many thanks for your advices and help.