3 Replies Latest reply: Nov 22, 2010 9:59 AM by Miguel Angel Baeyens de Arce RSS

    How to join two tables

       

      Hi.

      I have two tables which I would like to join into one.

      Table 1

      Item: name:

      1 a

      2 b

      3 c

      4 d

      5 e

       

      Table 2

      Item: name:

      6 f

      7 g

       

      I would like to have tabe 2 included in table one

       

      Table 1

      Item: name:

      1 a

      2 b

      3 c

      4 d

      5 e

      6 f

      7 g

       

      Can someone please help me?

       

      Regards

      Markus

       

       

        • Re. :How to join two tables

          Use CONCATENATE Like this :

           

          [Table1]:

          LOAD * FROM TABLE1 ...

           

          [Table2]:

          CONCATENATE ('Table1') LOAD * FROM TABLE2 ....

           

          Hope this help

          Marlot

            • Re. :How to join two tables

              Hi, I didn´t follow you. Maybe I didn´t describe the issue correct.

              I will try again.

               

              I have two files with different information which I would like to join into one.

               

              Item:

              LOAD

              item_number,

              item_description

              FROM $(vPathQvdRaw)\Item.qvd (qvd);

               

              Services:

              LOAD

              "service_code",

              "service_description";

              SQL SELECT *

              FROM swedb.dbo.service;

               

              item_number and service_code is a item number coming from different tables/sources and named differently. I would like to include the service_code into the item table.

              How should I write it into the script?

              Markus

               

                • Re. :How to join two tables
                  Miguel Angel Baeyens de Arce

                  Helo Markus,

                  If item_number in the qvd file and service_code in the SQL database are the same field but with different names, then just renaming the field and concatenating tables will work, as suggested above

                   

                  Item:LOAD item_number, item_descriptionFROM $(vPathQvdRaw)\Item.qvd (qvd);CONCATENATE LOAD "service_code" as item_number, "service_description" as item_description;SQL SELECT *FROM swedb.dbo.service;


                  Now "Item" table will have all the information so you can STORE it in one file.

                  Hope this helps.