NHibernate(4) HQL 分组、统计、映射

 

 ICriteria iCriteria = session.CreateCriteria(typeof(IEPDailyStatic));

 

iCriteria
.SetProjection(Projections.ProjectionList()
.Add(Projections.GroupProperty("Month"))
.Add(Projections.Property("Month"))
.Add(Projections.Sum("Count"))
.Add(Projections.Sum("Quantity"))
.Add(Projections.Sum("PaidMoney")))
.Add(Restrictions.Between("DeliveryDate", criteria.FromDate.ToString("yyyy-MM-dd"), criteria.ToDate.ToString("yyyy-MM-dd")))
.Add(Restrictions.Eq("SchedulingStatus", 5));

 

按照 字段 “Month” 进行分组,对字段 “Count”,“Quantity”,“PaidMoney” 进行统计,

posted @ 2012-04-17 09:07  巴别塔  阅读(1746)  评论(0编辑  收藏  举报