3 Replies Latest reply: Nov 9, 2012 5:32 AM by jagan mohan rao appala RSS

    Loading Data and Group by

      Hello,

       

      I was given a task to check a script

       

      but the thing is i have 2 questions

       

      1- The first quwstion is do I need to Load a pre loaded  data if I will use it in the left join field ??? look at the part of the script

       

      Left JOIN(CompanyPerformance)
      LOAD

            
      SalesNumber,

            
      if(MaxAXESalesNumber - SalesNumber = '0', '1', '0') as FlagMaxAXESalesNumber


      Resident
      CompanyPerformance;

       

      We loaded the Sales number in a previous left join ... Do we really need to load it here again ?

       

      --------------------------------------------------------------------------------------------------------

       

       

      2- The second question is do I need to load data if I will Group by the loaded data by it?? look at the second script

       

      Left JOIN(CompanyPerformance)


      LOAD

            
      Origin,

            
      max(SalesNumber) as MaxAXESalesNumber


      Resident CompanyPerformance GROUP BY  Origin;

       

      Thanks



        • Re: Loading Data and Group by
          Celambarasan Adhimulam

          Hi,

           

          1. Yes you need to load the Sales number to join based on this field.

          Because QV considers Company Performance as one table and the table derived from the company performance as another. By this it joins the data based on the common fields(field name in common).

           

          2.Can you explain you question as briefly?

            • Re: Loading Data and Group by

              Hi Adhimulam,

               

              Thanks for the reply,

               

              Regarding the first question: SalesNumber was loaded every time we used it, is that right?

              I mean I can find it in at least 6 Left Join in the script.

               

               

              2nd Question:

               

              in the script we load Origin and at the end we group by Origin, do I need to Load Origin every time I will Group By Origin ?

               

               

              Thanks

                • Re: Loading Data and Group by
                  jagan mohan rao appala

                  Hi,

                   

                  You must load the Dimension field which is going to be used in Join.  For example in the below script

                   

                  Left JOIN(CompanyPerformance)

                  LOAD

                        
                  Origin,

                        
                  max(SalesNumber) as MaxAXESalesNumber


                  Resident CompanyPerformance GROUP BY  Origin;

                   

                   

                  You have load Origin then only the Origin in the load table is joined with CompanyPerformance.Origin value.

                   

                  Hope this helps you.

                   

                  Regards,

                  Jagan.