concatenate rows
Posted: Tue 28 Jul 2009 09:37
Hi all,
I have written a bit of linq where it gets data from the db in the form of
Id Name Category
1 Name1 Cat1
2 Name2 Cat1
3 Name1 Cat3
I am trying to merge Category column for same Ids, something like:
Id Name Category
1 Name1 Cat1, Cat3
2 Name2 Cat1
How is this possible in LINQ? My statement is
var query = from p in table
select new {p.Id, p.Name, p.Category}
Any help would be appreciated.
Thanks
I have written a bit of linq where it gets data from the db in the form of
Id Name Category
1 Name1 Cat1
2 Name2 Cat1
3 Name1 Cat3
I am trying to merge Category column for same Ids, something like:
Id Name Category
1 Name1 Cat1, Cat3
2 Name2 Cat1
How is this possible in LINQ? My statement is
var query = from p in table
select new {p.Id, p.Name, p.Category}
Any help would be appreciated.
Thanks