我正在尝试使用linq编写左连接但它会出错。这是sql代码:
Select
Case s.StudentID
When 1000 Then s.Amount
End As Amount
From Student s
Left Join Course cOn c.Time = s.ForDate And c.StudentID= s.ID And s.Amount= 1000
这是我尝试过的代码,但是它给左连接错误了:
from s in Student
join c in Course
on new {s.ForDate , s.ID}
equals new { c.Time, c.StudentID}
into inj
from i in inj.DefaultIfEmpty()
where s.Amount= 1000
答案 0 :(得分:0)
试试这个
from s in Student
join c in Course on new {A=s.ForDate ,B= s.ID}
equals new {A= c.Time,B= c.StudentID}
into inj
from i in inj.DefaultIfEmpty()
where s.Amount == 1000
select new{
///
}