groupby multiple columns in a F# 3.0 query

前端 未结 8 851
梦如初夏
梦如初夏 2020-12-14 00:02

Just trying out F# 3.0 and hit a bit of a wall when it comes to grouping by multiple columns. The obvious thing to try was

query {
    for d in context.table         


        
8条回答
  •  醉话见心
    2020-12-14 00:25

    open Microsoft.FSharp.Linq.RuntimeHelpers
    open System.Linq
    
    query {
        for d in context.table do
        let t = MutableTuple<_,_>(Item1=d.col1,Item2=d.col2)
        groupValBy d t into g
        select (g.Key,g.Count())
        } 
    

提交回复
热议问题