8 Replies Latest reply: Nov 27, 2014 3:53 AM by antonio bassanelli RSS

    join from table in two different database

      I have got 2 table and I must to do a query, but these table are in two distinct data base.

       

      es

       

      table      tab_prov  (in database db_prov.accdb)                                    table   tab_paesi (in database db_paesi.accdb)

       

                     id_p     provincie                                                                         fk_p    paesi 

       

                     1           viterbo                                                                           1        corchiano

       

                     2           roma                                                                             1        vasanello

       

                                                                                                                      2        velletri

       

      I must this query:

       

      select

      provincie,paesi                                                                     

       

      from tab_prov, tab_paesi  where tab_prov. id_p = tab_paesi.fk_p

      i have used two distinct odbc connection, but it is not exactly. 

      Help me.

      Thank you

        • Re: join from table in two different database
          Alessandro Saccone

          in qlik you can use

           

          odbc connect to db1

           

          load ... from tab1

           

          odbc connect to db2

           

          left join

           

          load ... friom tab2

           

          otherwise in the select you can specify the db names before tables

          • Re: join from table in two different database
            Anand Chouhan

            Hi,

             

            In qlikview load this tables with different ODBC connection string and make joins between them by common key fields see example for this

             

            1.

            Table1:

            tab_prov  (in database db_prov.accdb)                                 

                 id_p     provincie                                                                      

                   1           viterbo                                                                       

                   2           roma                                                                          

             

            2.                                                                                                         

            tab_paesi (in database db_paesi.accdb)

            Table2:

            fk_ppaesi
            corchiano
            vasanello
            velletri

             

            3.

            NewTable2:

            Load

            fk_p as id_p,

            Paesi

            Resident Table2;

             

            Drop table Table2

             

            Join

            Load id_p, provincie

            Resident Table1;

            Drop Table Table1;

             

            Let me know and check this way

             

            Regards

            Anand