2013-09-26 158 views
0

嗨,我是新來的SQL和LINQ,我需要這條SQL語句轉換爲LINQ如何SQL SELECT語句轉換爲LINQ

select r.*, 
(Select name From org_table where org_ID= r.org_ID)org 
(Select name From Depart_table where Depart_ID= r.Depart_ID)depart 
from reserve_table r 
where name like ' 
+0

你試過? – Sajeetharan

+1

是你的'where like name'聲明不完整? – Marco

回答

0

試試這樣說:

var result = from r in reserve_table 
      where r.name.Contains("something") 
      select new { 
          org = (from o in org_table where o.Org_ID = r.Org_ID select o.name) 
          depart = (from d in Depart_table where d.Depart_ID = r.Depart_ID select d.name) 
          // add the rest 
         }