LINQ 學習筆記(8)實作Left Join(2) 多表單多條件式

莊創偉
1 min readNov 14, 2017

--

資料表如上圖所示

實作以Teacher left join Student 與Score三個表,T-SQL 語法如下

select o.Classname,.... from Teather as o left join Student as p
on o.Classname=p.ClassName
left join Score as s
on o.Class=s.Class and s.studentID=p.ID
order by o.Classname.....

--

--

莊創偉
莊創偉

Written by 莊創偉

學海無涯。但是為了生計還是得下海的風塵男子

No responses yet