通过下面的这种语句,可以对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
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