日期:2014-05-20 浏览次数:20818 次
var obj = from t in context.Table2
select new
{
t.TYPE,
M = (t.TYPE == "0" ? context.Table2.Select(a => a.MONEY).Sum() : t.TYPE == "1" ? context.Table2.Select(b => b.MONEY).Sum() : 0)
};
var obj = from t in context.Table2
let temp=context.Table2.Sum(a => a.MONEY)
select new
{
t.TYPE,
M = (t.TYPE == "0" ? temp : t.TYPE == "1" ? temp : 0)
};