我想下面的SQL代碼轉換成LINQ to SQL的,但似乎無法找到一種方法LINQ到SQL:多列求和選擇
select holder_name,agent_code,sum(total)
from agent_commission
group by agent_code
誰能幫助我?有一段時間我有點陷入這種困境。
在此先感謝
更新: 我嘗試以下
var query = (from p in context.Agent_Commissions
group p by new
{
p.agent_code
}
into s
select new
{
amount = s.Sum(q => q.total),
}
);
如何選擇另外兩列?我錯過了什麼?
這個問題是.net代碼爲linq-to-sql,它是如何來它屬於服務器故障? – vittore
'from a ctx.agent_code 將a組合爲a.holder_name,a.code組合成合計 select {holder_name = a.holder_name,code = a.code,total = totals}' – vittore
@vittore對於標籤中的拼寫錯誤... – Bahdeng