3 Replies Latest reply: Oct 18, 2011 6:06 AM by Sokkorn Cheav RSS

    Group data in the load script

    Sunil Kenth

      Hi all,

       

      I need some help with some syntax on how to group data together in the load script.

       

      The field in my table is called Supplier_Category and I would like to group entries in this field that = 'Company A', 'Company B' and 'Company C' and then name this group as 'Partners'.

       

      Thanks for your help in advance.

       

      Sunil

        • Group data in the load script

          Load

               Supplier_Category as Partners,

               Max(1) as Temp

          From YourDataSource

          Group By Supplier_Category

          Where

               Supplier_Category = 'Company A' or

               Supplier_Category = 'Company B' or

               Supplier_Category = 'Company B'

          ;

           

           

           

          Any addtional fields added in to the Load statement must also be added to the group by statement.

           

          Jay

            • Re: Group data in the load script
              Sunil Kenth

              Hi Jay,

               

              Thanks for your prompt response.

               

              I think I probably didn’t explain clearly what I wanted.  I still want the field to be called Supplier_Category but I need to group/categorise/rename certain values (Company A, Company B, etc) within the field as ‘Partners’.

               

              Something like:

              if

              ((Supply_Category)='Company A', & if(Supply_Category)='Company B') as Partners

               

               

              Is this possible in the load script?

               

              Thanks,

               

              Sunil

            • Group data in the load script
              Sokkorn Cheav

              Hi Sunil,

               

              This one should have a master data for group name. If it doesn't have, you need to load with a hard script like this

              [TableName]:

              LOAD

                  CompanyField,

                  IF(CompanyField='Company A' OR CompanyField='Company B' OR CompanyField='Company C','Partners','-')    AS [Group]

              FROM YourTable

               

              Regards,

              Sokkorn