14 people like it.
Like the snippet!
Query groupBy multiple columns (SqlDataConnection type provider)
Querying a players table grouped by first, then by the last name and counting the number of occurrence
1:
2:
3:
4:
5:
6:
|
query {
for row in Players do
let key = AnonymousObject<_,_>(row.NameFirst, row.NameLast)
groupValBy row key into grouping
select (grouping.Key.Item1, grouping.Key.Item2, grouping.Count())
} |> Seq.iter (fun row -> printfn "%A" row)
|
val query : Linq.QueryBuilder
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.query
val row : obj
val key : obj
custom operation: groupValBy ('Value) ('Key)
Calls Linq.QueryBuilder.GroupValBy
val grouping : System.Linq.IGrouping<obj,obj>
custom operation: select ('Result)
Calls Linq.QueryBuilder.Select
property System.Linq.IGrouping.Key: obj
module Seq
from Microsoft.FSharp.Collections
val iter : action:('T -> unit) -> source:seq<'T> -> unit
Full name: Microsoft.FSharp.Collections.Seq.iter
val row : obj * obj * obj
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
More information