`
leng_cn
  • 浏览: 298092 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

取得hibernate group by的COUNT的方法:)

阅读更多
通过下面的这种语句,可以对GROUP BY的数据进行COUNT统计:)
Select count(*) From T_Sale_Lead t

Where t.id In(Select max(t.id) From T_Sale_Lead t  Where t.T_Happen_Year=2008 and
t.T_Happen_Month In(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)

Group by t.T_Cluster_Code,t.T_Happen_Year,t.T_Happen_Month )

下面是hql的语句:)
Select  t.TClusterCode,t.THappenYear,t.THappenMonth,Sum(t.TCashChnNum) ,Sum(t.TAccChnNum),Sum(t.TSaleChnNum)  From TSaleLead t  Where t.THappenYear=2008 and t.THappenMonth In(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) Group by t.TClusterCode,t.THappenYear,t.THappenMonth  order by t.TClusterCode desc
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics