【发布时间】:2013-03-26 22:45:34
【问题描述】:
我只是想为以下 sql 查询语句创建等效的 linq 或 lambda 表达式:
select(sum(a.credit) - sum(a.debit)) as total
from table_A a inner join table_B b on
a.accountid = b.id
where a.[date] >= '2013-01-01'
and a.[date] < '2013-03-27'
and b.Name = 'MKBank'
感谢任何帮助。
【问题讨论】:
-
我试过 var p = db.Account_Transaction.join(db.Accounts,o=>o.AccountId,p=>p.ID,(o,p)=>new{o,p} ).where(o=>o.o.Date >= '2013-01-01' && o.o.Date new{grp.o.debit,grp.o.credit} ).select(result=>new {result.sum(o=>o.o.credit-o=>o.o.debit)});但我遇到了一个错误,比如无效的匿名声明符等。