处理 Distinct Count
#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Linq.dll";;
#r @"E:\Projects\F#3\FSharp.Data.TypeProviders.dll";;
open Microsoft.FSharp.Data.TypeProviders;;
open System.Linq;;
// Count()、DefaultIfEmpty 在其中
//open System.Data.Linq;;
//open System.Data.Linq.SqlClient;
// SqlMethods 作其中
[<Generate>]
type T0 = SqlDataConnection<"Data Source=.\SQLEXPRESS;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234">
let TypeProvider9() =
let db = T0.GetDataContext()
let q = query {
for s in db.Student do
join (for c in db.CourseSelection -> s.StudentID = c.StudentID)
distinct
count
}
printfn "distinct count = %d" q