db2 - Is there a way to Concat multiple rows into one but keep each column value as a seperate column? -


i know possible want listagg adds of values 1 column.

for example if have this

subjectid       studentname ----------      ------------- 1               mary 1               john 1               sam 2               alaina 2               edward 

i hoping this

subjectid       studentname       studentname1       studentname2  ----------      -----------       ------------       ------------ 1               mary              john               sam                2               alaina            edward             0 

this called pivoting , described in article


Comments

Popular posts from this blog

string - Using python and postgres, variables within execute function? -

python - Creating a new column in a dataframe based on the result of the addition of three others -