5 Replies Latest reply: Mar 1, 2017 9:22 AM by omar bensalem RSS

    hierarchy of tables

    ignacio blanco

      hi,

      i have 3 tables, and the unión between this tables is ClientCode.

      i match the tables in data manager, and then associations, but don respect the hierachy, it´s posible to give that dependence?

      like a left join or inner join in SQL?

       

      Thanks for all!

        • Re: hierarchy of tables
          omar bensalem

          When you load table via load editor, it will create an automatic script.

           

          Go to the data load, find the script, in the up right , unlock the generated script so that you can modify it.

           

          Let's assume you have 2 tables:

          do this: (table1 will be the 'master table'

           

           

          Table 1 :

           

          ClientCode,

          b,

          c

          from ...table 1;

           

           

          leftjoin(Table1)

          Table 2 :

           

          ClientCode,

          k,

          j

          from ...table 2;

           

           

          ho^pe this was clear,

           

          Omar,

            • Re: hierarchy of tables
              ignacio blanco

              yes, it`s OK but the column of the unión?

              i have some columns with the same name in both tables, i want to say in the script that the column of the unión is ClientCode.

              thanks

                • Re: hierarchy of tables
                  omar bensalem

                  Qlik does not opperate like this; it does the association via the name of the fields. If you want a join in one field, you have to rename other fileds

                   

                  But if your data source is oracle for example, you can do the join in the select part :

                   

                  // here is the qlik language :

                  load *

                   


                  //
                  here you can use the sql language of your data source

                  select

                   

                  left join table2 on field= table1.field

                  from bla bla



                  I hope that was clear

                    • Re: hierarchy of tables
                      ignacio blanco

                      with the same name it Works a Little bit better but i have an other error.

                      i have

                      Table 1 :

                       

                      ClientCode,

                      b,

                      c

                      from ...table 1;

                       

                       

                      leftjoin(Table1)

                      Table 2 :

                       

                      ClientCode,

                      k,

                      j

                      from ...table 2;

                       

                      leftjoin(Table2)

                      Table 3:

                       

                      ClientCode,

                      w,

                      z

                      from ...table 3;

                       

                       

                      The following error occurred:

                      Table 'Table 2' not found

                        • Re: hierarchy of tables
                          omar bensalem

                          when you do leftjoin(table1), you'll have only one table left (table2 will be joined to table one)

                           

                          thus: in your last load:

                           

                          leftjoin(Table2)

                          Table 3:

                           

                          ClientCode,

                          w,

                          z

                          from ...table 3;

                           

                          there is no table2 , because it's already a part of table 1 :

                           

                          try

                          leftjoin(Table1)

                          Table 3:

                           

                          ClientCode,

                          w,

                          z

                          from ...table 3;