Hibernate中使用聚集函数查询

来源:互联网 发布:邪恶小说软件下载 编辑:程序博客网 时间:2024/05/28 23:20
聚集函数查询:
public Long totalByTimeToRechargeRecord(String stime, String etime,Long pointid) {// TODO Auto-generated method stubString sql="";     sql="select sum(zs.money) from Golddetailtopoint zs where zs.zspoint.pointId="+pointid +" and zs.gdtptime between '"+stime+"' and '"+etime+"' order by zs.gdtpId desc";    Long totalMoney = (Long)this.getSession().createQuery (sql).uniqueResult();    return totalMoney;}


avg(...),sum(...), min(...),max(...),count(...)


0 0
原创粉丝点击