2 Replies Latest reply: Dec 1, 2017 12:23 PM by Kailash Kotak RSS

    Joining 2 tables twice

    Kailash Kotak

      Hello,

       

      I am working with a very huge data set wherein I need to first join the table by Unique Identifier and then by email address.

       

      2 of my tables look like following

      Table1:

      Emp Name     Emp Email ID     Unique Identifier     Manager     Office address    

      A                    abc_gmail.com       1                              John               New York    

      B                    abc1_gmail.com     2                              Ed                  Houston 

      C                    abc2_gmail.com     3                              Raj                  Dallas

      D                    abc3_gmail.com     4                              KK                   Jersey

       

      Table2:

      Charges          Unique Identifier          emailID                          Division          Company          

      10                         3                           abc2_gmail.com                 G                     Po                   

      20                         2                           abc1_gmail.com                  O                    LO

      30                                                      abc_gmail.com                    L                      ZO

      40                         3                           abc2_gmail.com                   Z                    DO

       

      I want to join both the tables first by Unique identifier 2 and 3 and then join  3 & 4 by email ID. Is this possible ? Both tables have about 500000 rows and about 30-35 columns.

        • Re: Joining 2 tables twice
          Shraddha Gajare

          what do you mean by

          I want to join both the tables first by Unique identifier 2 and 3 and then join  3 & 4 by email ID

          2 and 3 a values of Unique identifier?

           

          You can directly join it by Unique Identifier.

          Why do you want to join it twice? What is the expected Output?

            • Re: Joining 2 tables twice
              Kailash Kotak

              Hi Shraddha,

               

              Apologies for late reply.

               

              The problem here is the quality of data isn't good in my tables, please ignore the previous tables. The unique identifier column actually isn't unique For example Unique ID 2 belongs to Ed and also to KK. SO,now when i want to see charges for Ed, The actual charges for Unique ID will be 20 but since KK is also using the Same ID, qlikview shows the total as 20 but will show charge of 20 in front of both names, KK and Ed. So first I want to join by Unique ID and then by email.

               

              Table1:

              Emp Name     Emp Email ID     Unique Identifier     Manager     Office address    

              A                    abc_gmail.com       1                              John               New York    

              B                    abc1_gmail.com     2                              Ed                  Houston 

              C                    abc2_gmail.com     3                              Raj                  Dallas

              D                    abc3_gmail.com     2                              KK                   Jersey

               

              Table2:

              Charges          Unique Identifier          emailID                          Division                  

              10                         3                           abc2_gmail.com                 G                

              20                         2                           abc1_gmail.com                  O               

              30                          4                                             L                

              40                         3                           abc2_gmail.com                   Z      

               

              Now here again the email id column also has many blanks in table 2. So wherever there is blank my manager is fine with showing double values but wherever the email ID is available he wants the exact value.

               

              I am not sure if it makes sense ?

               

              Thanks & Regards,

              Kailash Kotak