处理 Left Join
#r @"C:Program FilesReference AssembliesMicrosoftFramework.NETFrameworkv4.5System.Data.Linq.dll";;
#r @"E:ProjectsF#3FSharp.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 TypeProvider7() =
let db = T0.GetDataContext()
let q0 = query {
for s in db.Student do
join (for c in db.Course -> s.StudentID = c.CourseID)
select s
}
let q = query {
for e in q0.DefaultIfEmpty() do
select e
}
q |> Seq.iter (fun n -> printfn "%A" n.Name)
q |> Seq.length
最后
以上就是清爽西牛最近收集整理的关于处理 Left Join的全部内容,更多相关处理内容请搜索靠谱客的其他文章。
发表评论 取消回复