當 多條件 left join on 時 LEFT OUTER JOIN on new { u.UserId, ue.ExamId } equals new { sac.UserId, sac.ExamId } into sac2 from sac in sac2.DefaultIfEmpty() ...
當 多條件 left join on 時
LEFT OUTER JOIN
on new { u.UserId, ue.ExamId } equals new { sac.UserId, sac.ExamId }
into sac2
from sac in sac2.DefaultIfEmpty()
生成Sql 為
ON ([Filter1].[UserId1] = [GroupBy1].[K1]) AND (([Filter1].[ExamId2] = [GroupBy1].[K2]) OR (([Filter1].[ExamId2] IS NULL) AND ([GroupBy1].[K2] IS NULL)))
單條件 on 時
sql on 沒有空值判斷
LEFT OUTER JOIN [dbo].[SysQuestion] AS [Extent3] ON [GroupBy1].[K1] = [Extent3].[QueId]