How about this? let mapGrouping f (xs : IGrouping<_,_>) = let projection = xs |> Seq.map (fun x -> xs.Key, f x) (projection.GroupBy (fst, snd)).First() From your code example, I think you want this: query { for i in taggedItems do groupValBy i.Item i.Tag into g select g } At...

c#,linq,sql-order-by,igrouping

If you can, just put the ordering earlier, e.g. var states = SimulationPanel.innerPanel .Children .OfType<StateBar>() .Where(x => x.isSensorState()) .OrderBy(x => (decimal)(x.Margin.Left / SimulationPanel.Zoom)) .GroupBy(...); (Or put a Select before the OrderBy and make the GroupBy simpler.) If you really need this though, you could write your own IGrouping<TKey, TElement> implementation...

To just get the BoughtById that is in each you want the intersection of the three sets of keys: var boughtAll = boughtApples.Select(gr => gr.Key) .Intersect(boughtCoconuts.Select(gr => gr.Key)) .Intersect(boughtOranges.Select(gr => gr.Key)); boughtAll will now be an IEnumerable<int> or IQueryable<int> as appropriate. To then get the corresponding groups you want to...