日期:2014-05-20  浏览次数:20833 次

这句sql查询语句如何转为lambda方法语法?
SELECT snum, sum(p) FROM tab1 where (sTime BETWEEN '20110628' AND '20110710') group by snum,这句如何转为方法语法?如何表达between...and...这样的意思呢?

------解决方案--------------------
var query=from t in tab1
where t.sTime>=Convert.ToDateTime("20110628") &&
t.sTime<=Convert.ToDateTime("20110710")
group t by t.snum into g
select new 
{
snum=g.Key,
sum=g.Sum(m=>m.p)
};