5 Replies Latest reply: Sep 11, 2017 2:34 AM by Petr Kyncl RSS

    join two tables based on criteria in script

    Supriya R

      Hi all,

      i have two tables from which i need to create fact table like below. In table 2 if i found comm_type_id rows that are not in table 2, those records should be appended to table1.

       

      Table1:

       

      batch_idcampaign_idcomm_type_idsent
      2334356
      23344566
      233455
      2335634
      233592

       

      Table2:

       

      batch_idcampaign_idcomm_type_idsent
      233463
      2334834
      233562
      233573
      233594
      2335114
      2335105
      233637
      233648
      2336545

       

       

      FactTable:

       

       

      batch_idcampaign_idcomm_type_idsentnot required just reference
      2334356T1
      23344566T1
      233455T1
      233463T1
      2334834T1
      2335634T1
      233592T1
      233573T2
      2335114T2
      2335105T2
      233637T2
      233648T2
      2336545T2

       

      if they are multiple records for same comm_type_id then record in table 1 should only be included in facttable.

       

      how could i do this?