当前位置 : 主页 > 手机开发 > ROM >

linq表连接

来源:互联网 收集:自由互联 发布时间:2021-06-10
SELECT ( SELECT d.DeptName FROM Dept d WHERE d.Id=p.DeptId ) DeptName, count( p.DeptId) AS Count FROM Person pGROUP BY p.DeptIdvar dept = (from p in db.Person group p by p.DeptId into g join d in db.Dept on g.Key equals d.Id select new { co

SELECT    ( SELECT d.DeptName FROM Dept d WHERE d.Id=p.DeptId  ) DeptName,    count( p.DeptId) AS Count FROM   Person pGROUP BY    p.DeptIdvar dept = (from p in db.Person                                               group p by p.DeptId into g                        join d in db.Dept                       on g.Key equals d.Id                        select new                        {                            count=g.Count(),                            g.Key,                            DeptName = d.DeptName                        }                                                ).ToList();搜索微软知识时加 msdn en-us=>zh-cn

网友评论