table a(id, type): id type ---------------------------------- 1 1 2 1 3 2 table b(id, class): id class --------------------------------- 1 1 2 2 sql语句1:select a.*, b.* from a left join b on a.id = b.id and a.type = 1;…
还是习惯先撸一段SQL * FROM User_Pic P AND P.Guid = R.UserPicGuid ORDER BY PicSize DESC 然后发现Linq中的join不能多条件... 结果找到解决方案如下 ; var pic = (from p in db.User_Pic join r in db.R_User_Pic on new { _guid = p.Guid, _id = ID } equals new { _guid = r.UserPicGuid, _id =…
public ActionResult Edit(int id) { using (DataContext db = new DataContext(ConfigurationManager.ConnectionStrings["sqlConnection"].ConnectionString)) { IQueryable<ClassInformation> result = from c in db.GetTable<TClass>() join t in d…