日期:2014-05-20 浏览次数:20951 次
select sum(UserConsumeMoney) as totalMoney, convert(nvarchar(7), ConsumeDay,120)
as monthConsume from T_UserConsumeDay
group by convert(nvarchar(7), ConsumeDay,120)
var query=from t in T_UserConsumeDay
group t by t.ConsumeDay.ToString("yyyy-MM") into g
orderby g.Key
select new
{
totalMoney=g.Sum(m=>m.UserConsumeMoney),
monthConsume=g.Key
};