How can I group an up to 7 number of rows into a single row where the set columns determine the grouping?
I dont have fix rows.
I saw Stack overflow already has this question but answer is in SQL.
I need LINQ. I dont know how can I achieve this ?
Please have a look at StackOverflow link below
T- SQL group rows into columns
Table
Id RefId Name
------------------------
1 1 Test1
2 1 Test2
3 1 Test3
4 2 Test4
5 2 Test5
So, Output would be ..
RefId Name1 Name2 Name3 Name4 Name5 Name6 Name7 Id1 Id2 Id3 Id4 Id5 Id6 Id7
-----------------------------------------------------------------------------------
1 Test1 Test2 Test4 null null null null 1 2 3 null null null null
2 Test4 Test5 null null null null null 4 5 null null null null null
Here, it is fixed that rows comes up to 7 .. not more than that