/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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 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 } );
URL: http://stackoverflow.com/questions/2861202/linq-query-with-subquery-as-comma-separated-values