1 Reply Latest reply: Dec 9, 2011 12:50 PM by Robinson Selvaraj RSS

    Help with aggregation/group by

    Donald Posthuma

      Hi everybody,

       

      I have  a general question about group by statements. Right now I have a table where I want to Group based on OrderId but there are several other Fields. Say OrderId is Field 1, Field 2  might have different values but for every OrderId are unique and I have Field 3 which needs to be Summed. So I have the following

       

      LOAD

           Field1,

           Field2,

           SUM(Field3) AS Field

      RESIDENT

           Test

      GROUP BY Field1

       

      This statement will give an error since i think it is neccessary to include Field2 even tough this field has the same values for each value in Field1. Or I'm I incorrect on this assumption? Can anyone explain the exact rules for the fields which are not aggregated nor grouped but you do want to Load?