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 (); Search Microsoft Knowledge Add msdn en-us=>zh-cn
LINQ table connection
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3969 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC