日期:2014-05-20  浏览次数:20801 次

求Ling写法,多表
select * from A left join B on A.x=B.x and A.y=B.y


C# code
            var a = (from R in Result
                     join T in SuccessionGradeChains on R.GradeCode equals T.GradeCode into os 
                     from TT in os.DefaultIfEmpty()
                     select new{
                         R.GradeCode,
                         R.DisciplineCode,
                         SuccessorGradeNo = (TT == null ? null : TT.SuccessorGradeNo)
                     });




在on后面也要加一条件,现在无从下手
试and无效

------解决方案--------------------
C# code
 
var a = (from R in Result
                     join T in SuccessionGradeChains on new{GradeCode = R.GradeCode,GradeName=R.GradeName} equals new{ GradeCode =T.GradeCode,GradeName=T.GradeName} into os 
                     from TT in os.DefaultIfEmpty()
                     select new{
                         R.GradeCode,
                         R.DisciplineCode,
                         SuccessorGradeNo = (TT == null ? null : TT.SuccessorGradeNo)
                     });