groupby multiple columns in a F# 3.0 query

前端 未结 8 844
梦如初夏
梦如初夏 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:29

    Apparently there may be a solution as indicated in by using a combination of groupValBy and AnonymousObject<_,_> from the Linq RuntimeHelpers.

    ex.

    query {
        for d in context.table do
        let key = AnonymousObject<_,_>(d.col1,d.col2)
        groupValBy d key into g
        select (g.Key)
        } 
    

提交回复
热议问题