4 Replies Latest reply: Oct 12, 2015 2:58 AM by berker devirek RSS

    concatenate two different table

    berker devirek

      Hi,

       

      I have 2 tables,

       

      Order_IDVoucherOwner
      A1a
      B2a
      C3

      b

      Order_IDOwner
      Db
      Eb
      Fb


      I want to concatenate two table like this,


       

      Order_IDVoucherOwner
      A1a
      B2a
      C3b
      D0b
      E0b
      F0b


      How can I do that? One of the table is loaded from database and the other is from excel. I want to concatenate them at the front end.


      Thanks,


      Berker.

        • Re: concatenate two different table
          Srikanth P

          Since one of the source don't have voucher and you can create the Vocher field while loading.

           

          Please try Like below:

           

          Let's voucher is in Missing in Excel file.

           

          Data:

          Select

               Order_Id,

               Voucher,

               Owner

          From tablename;

           

          Concatenate (Data)

          Load

               Order_Id,

               0 as Voucher,

               Owner

          From ExcelFiel

          ;

           

          If Voucher is missing on the db table simple add dummy voucher value.

            • Re: concatenate two different table
              Sunny Talwar

              Alternatively you can do the check after you have concatenated also:

               

              Data:

              Select

                   Order_Id,

                   Voucher,

                   Owner

              From tablename;

               

              Concatenate (Data)

              Load

                   Order_Id,

                   Owner

              From ExcelFiel

               

              FinalData:

              LOAD Order_Id,

                        If(Len(Trim(Voucher)) = 0, 0, Voucher) as Voucher

                        Owner

              Resident Data;

               

              DROP Table Data;

              • Re: concatenate two different table
                berker devirek

                I tried this one but I couldn't succeeded. I could get only excel or only qvd, the data after concatenate is not loaded to KARGO_BEDAVA.QVD

                 

                here is my code.

                 

                KARGO_BEDAVA:

                 

                LOAD

                '$(vFIRMA)'&'|'&id as %KEY_CAMPAIGN_ID,

                'b' as Sahip,

                0 as Limit,

                0 as kargo_karsilama;

                SQL SELECT

                id

                FROM warehouse."public"."campaign_campaign";

                 

                Concatenate (KARGO_BEDAVA)

                 

                LOAD

                  '$(vFIRMA)'&'|'&id  as %KEY_CAMPAIGN_ID,

                  Sahip,

                  Limit,

                  kargo_karsilama;

                LOAD [Kampanya ID] as id,

                     Sahip,

                     Limit,

                     [Kargo Karsilama] as kargo_karsilama

                FROM

                [..\EXTERNAL\CRM Kurgular─▒.xlsx]

                (ooxml, embedded labels, table is Kargo);

              • Re: concatenate two different table
                Petter Skjolden

                If you want a "concatenation" in the front end you don't need to do anything. Just load the two tables as is. It will create a Synthetic Key which good practice tells you that you should resolve - but for this purpose of illustrating the logic it is not necessary to do that:

                 

                2015-10-12 #2.PNG

                 

                I have enclosed a demo of it.