String hql = "select count(*) from RawCaseRecorder where caseEndTime between '"+date1+"' and '"+date2+"' and punish_type_1 in('兽药行政处罚','饲料行政处罚') and caseType=3 group by ";
list = getHibernateTemplate().find(hql);
我想实现按月分组查询,请问大神我该怎么做,group by后面的语句我该怎么写?
急,在线等,求指教!
------解决方案--------------------
group by to_char(caseEndTime,'mm')
------解决方案--------------------
TO_DATE('19700101','yyyymmdd') +
caseEndTime/86400000 + TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))/24
这个long转date