# 怎么在LINQ做符号运算？

0

`sum(Wait_Time_Avg*(call_no - uncall_no))  SumWaitTime`

0
`var sumWaitTime = source.Sum(item => item.A * (item.B - item.C));`

zucker1988 | 小虾三级 |园豆：586 | 2014-05-07 10:55

0

linq不是有sum方法吗?还是说放在where里?

```SELECT (sum(Call_No)-sum(UnCall_No)) SumCallNo ,sum(Process_Time_Total)  SumProcessTime ,sum(Wait_Time_Avg*(call_no - uncall_no))  SumWaitTime ,max(Wait_People_Max)  MaxWaitPeople ";
strComm += " FROM branch_comparison_bykind WHERE BRANCH_ID='" + sDep.Trim() + "' " + commYear + commQuarter + commMonth + commWeekY + commWeekM + commDate;```

@许大虾: branch_comparison_bykind.where(m=>m.BRANCH_ID=='"'+m.sDep+'"'+m.commYear++++).select(m=>new{SumCallNo= branch_comparison_bykind.sum(Call_No)-branch_comparison_bykind.sum(UnCall_No),SumProcessTime=branch_comparison_bykind.sum(Process_Time_Total)})

@吴瑞祥: SumCallNo= branch_comparison_bykind.sum(Call_No)-branch_comparison_bykind.sum(UnCall_No)

@吴瑞祥: SUM（）这括号里面是要传的是转换函数而不是这种参数啊

@许大虾: ```说了是大概这个意思撒.改成

SumCallNo= branch_comparison_bykind.sum(t=>t.Call_No)-branch_comparison_bykind.sum(t=>t.UnCall_No)

您需要登录以后才能回答，未注册用户请先注册