8 Replies Latest reply: Aug 23, 2018 5:37 AM by Vincent Bellanger RSS

    Group by explanation

    Vincent Bellanger

      Greetings,

       

      I've a table like this

      School:

      NameClassTeacher
      DiazEnglishSantiago
      DiazFrenchTerry
      DiazGermanScully
      HoltEnglishSantiago
      HoltFrenchTerry
      HoltGermanScully
      PeraltaEnglishSantiago
      PeraltaFrenchHitchcock
      PeraltaGermanScully

       

      And i would like to change it to that way:

      Final:

      NameEnglishFrenchGerman
      DiazSantiagoTerryScully
      HoltSantiagoTerryScully
      PeraltaSantiagoHitchcockScully

       

      I'm doing it like this:

       

      Final: 

      LOAD  Name

      If( Class = 'English' , Teacher ) AS English, 

      If( Class = 'French' , Teacher ) AS French, 

      If( Class = 'German' , Teacher) AS German 

      RESIDENT  School ;

       

      But it give me this instead:

       

      NameEnglishFrenchGerman
      Diaz---
      DiazSantiago--
      Diaz-Terry-
      Diaz--Scully
      Holt---
      HoltSantiago--
      Holt-Terry-
      Holt--Scully
      Peralta---
      PeraltaSantiago--
      Peralta-Terry-
      Peralta--Scully

       

      I tried group by but i need an agregation function.

       

      Thanks for the answers!