2 Replies Latest reply: Jan 9, 2012 1:19 AM by Vijay Kumar RSS

    joining problem

    KEERTHY VISHWESHWARACHAR

      Hi Team,

       

      I am new to Qlikview. Here you go my question,

       

      I have created two QVD files A & B the joining key is C, so now I wanted to join these two table and create subset. Below is the SQL code for that.

       

      Select A.section,sum(B.sales) from A inner join B ON a.c=b.c Group by A.section;

       

      Can any one help me to create same query in Qlikview assuming we have two QVD's.

       

      Regards,

      Joyking

        • joining problem

          Hi Joy, welcome to the world of QlikView!

           

          In Qlikview, the way things are done is different to SQL. you load the tables one at a time, chopping changing them as you load more information and then in the final document the joins are performed dynamically using fields that share exactly the same name. The resulting data set when displayed in a document is like looking at a "full outer" join as everything is returned.

           

          What you want to do looks like you want to end up with a final table that is an intersection of A and B (only where they share the same C)

           

          to do this, you need to load one table, then join using the inner join() command

           

          Table1:

          load

          A,

          A2,

          C,

          from C:\Qlikview\A.QVD (qvd);

           

          inner join (Table1)

          Load

          B,

          B2,

          C

          from C:\Qlikview\A.QVD (qvd);

           

          Table 1 will now only contain the following: A,A2,C,B,B2 where the two tables shared a C.

           

          You can also use a "keep" statement, see the helpfile for more exaplanation

           

          Hope this helps,

           

          Erica

            • joining problem
              Vijay Kumar

              Hi,

              In addition to Erica, You can first Inner Join two tables A and B on Key C and then Aggregate the values.

               

              Eg:

               

              Table1:

              Load

              Section,

              C

              From A.qvd;

               

              Inner Join

               

              Load

              Sales,

              C

              From B.qvd;

               

              Table2:

              Noconcatenate

              Load

              Section,

              Sum(Sales)

              Resident Table1

              Group By Section;

               

              Drop Table Table1;

               

              Hope this will help.

               

              Regards

              VIjay