Been looking for a solution for this but haven\'t been able to find one so far.
I\'m fairly sure its possible with one linq call but having trouble working it out.>
If you're using Entity Framework and have Navigation Properties, you could do the following. It's not clear from the question whether this is the case though.
var query = db.YourTable
.Where(x => x.Parent != null && x.Parent.ValidFlag == 1)
.GroupBy(x => x.ParentId)
.Select(g => new { ParentId = g.Key, Children = g.ToList() })
.ToList();