2 Replies Latest reply: Jul 14, 2016 3:14 PM by Robin Hausdörfer RSS

    Doubt in concatenate

    Paulo Abreu

      Hi, Sorry for the basic question but this is not working:

       

      FactTable:

      Load A,B,C;

      SELECT ... FROM Table1;

       

      CONCATENATE (FactTable)

      Load A,B;

      SELECT ... FROM Table2;

      LEFT JOIN

      LOAD A,C;

      SELECT ... FROM SubTable;

       

       

      The LEFT join is workinf fine, if I run it alone Table2 and Subtable, column C is fine.

      So I was expecting Field C from Subtable to concatenate on FactTable,it returns NULL


      Any tip on what am I doing wrong?

      Thanks

        • Re: Doubt in concatenate
          Stefan Wühl

          Try doing the JOIN of your tables Table2 and SubTable in your SQL SELECT part (single LOAD statement so to say).

          • Re: Doubt in concatenate
            Robin Hausdörfer

            I think I know why it doesn't work...

            FactTable: Load A,B,C; SELECT ... FROM Table1; CONCATENATE (FactTable) Load A,B; SELECT ... FROM Table2;

            --> result is a table with Fields A,B,C, even if some C - Fields are null().

             

            LEFT JOIN LOAD A,C; SELECT ... FROM SubTable;

            will only work, if A and C match --> Synthetic Key!!!

             

            --> solution could be the following:

            FactTable: Load A,B; SELECT ... FROM Table2; LEFT JOIN LOAD A,C; SELECT ... FROM SubTable; CONCATENATE (FactTable) Load A,B,C; SELECT ... FROM Table1;

             

            --> first join (only A as Key), then concatenate the rest.

            You could even remove

            CONCATENATE (FactTable)

            because if all names are the same, QlikView will do an implicit concatenate.