Linq代码为group by和sum [英] Linq code for group by and sum

查看:97
本文介绍了Linq代码为group by和sum的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  SELECT  SUM(p.Runs + p.Wickets + p.Catches + p.Runouts) AS  points,u.UserId 
FROM tblPlayerUser AS pu INNER JOIN
tblUser AS u ON pu.UserId = u.UserId INNER JOIN
tblPlayer AS p ON pu.PlayerId = p.PlayerId
GROUP BY u.UserId





这是我的sql查询来获取记录。



我想要一个代码来执行这个查询在Linq到Sql的操作( C#)

任何人都可以帮助我

解决方案

得到了答案 http://forums.asp.net/p/1867685/5246669.aspx/1?Linq+code+for+group+by+and+sum [ ^

SELECT     SUM(p.Runs + p.Wickets + p.Catches + p.Runouts) AS points, u.UserId
FROM         tblPlayerUser AS pu INNER JOIN
                      tblUser AS u ON pu.UserId = u.UserId INNER JOIN
                      tblPlayer AS p ON pu.PlayerId = p.PlayerId
GROUP BY u.UserId



This is my sql query to fetch the records.

I want a code which will perform this query''s operation in Linq to Sql(C#)
Can Anyone help me

解决方案

Got my answer http://forums.asp.net/p/1867685/5246669.aspx/1?Linq+code+for+group+by+and+sum[^]


这篇关于Linq代码为group by和sum的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆