Revision: 37120
Updated Code
at December 4, 2010 02:53 by housecor
Updated Code
var secondaryContents = (from c in context.ProductSecondaryContents join cs in context.ProductSecondaryContentStates on c.ProductSecondaryContentID equals cs.ProductSecondaryContentID join s in context.States on cs.StateCodeID equals s.StateID where c.ProductID == ProductID group s.Code by new { c.ProductSecondaryContentID, c.CreateDateTime, c.GroupName } into g select new { g.Key.ProductSecondaryContentID, g.Key.CreateDateTime, g.Key.GroupName, State = g.Select(st=>st).Distinct() }).ToList().Select(l=> new { l.GroupName, ApplicableStates = string.Join(", ", l.State.ToArray()), l.CreateDateTime, l.ProductSecondaryContentID } );
Revision: 37119
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 4, 2010 02:52 by housecor
Initial Code
var secondaryContents = (from c in context.ProductSecondaryContents join cs in context.ProductSecondaryContentStates on c.ProductSecondaryContentID equals cs.ProductSecondaryContentID join s in context.States on cs.StateCodeID equals s.StateID where c.ProductID == ProductID group s.Code by new { c.ProductSecondaryContentID, c.CreateDateTime, c.GroupName } into g select new { g.Key.ProductSecondaryContentID, g.Key.CreateDateTime, g.Key.GroupName, State = g.Select(st=>st).Distinct() }).ToList().Select(l=> new { l.GroupName, ApplicableStates = string.Join(", ", l.State.ToArray()), l.CreateDateTime, l.ProductSecondaryContentID } );
Initial URL
http://stackoverflow.com/questions/2861202/linq-query-with-subquery-as-comma-separated-values
Initial Description
Initial Title
LINQ subquery group by to produce comma delimited results for a specified column
Initial Tags
Initial Language
C#