日期:2014-05-20 浏览次数:20906 次
SELECT
CONVERT(varchar(6), ActualSendTime,112),
COUNT(1),
SUM(a.ReceivablePrice),
COUNT(distinct customerid)
FROM Delivery a
WHERE OrderStatusID=5
group by CONVERT(varchar(6), ActualSendTime,112)
var query=from a in Delivery.ToList()
where a.OrderStatusID==5
group a by a.ActualSendTime.ToString("yymmdd") into g
select new
{
Time=g.Key,
Count=g.Count(),
price=g.Sum(x=>x.ReceivablePrice),
cid=g.Select(x=>x.customerid).Distinct().Count()
}