select sum(Convert(int,t.para_value)),t.para_key from (
select * from biz_order_para where order_id in (1906,2907,2908,2909,2910,2911)
) t where t.para_key in ('Quota','Traffic','DBSpace') group by t.para_key
怎么用linq编写这个sql
LINQ
分享到:
------解决方案--------------------
var query=from t in db.biz_order_para.Where(x=>new int[]{1906,2907,2908,2909,2910,2911}.Contains(x.order_id)
where new string[]{"Quota","Traffic","DBSpace"}.Contains(t.para_key)
group t by t.para_key into g
select new {v=g.Sum(s=>Convert.ToInt32(s.para_value)),g.Key};