oracle Group by 分组查询后,分页

public Map getInWareHouseReport(int i, int j, InWareHouse inWareHouse) {
        //查询分组后总条数
        String countquery="select WS_SKU_ID,sum(IN_NUMBER),sum(WH_MONEY) from IN_WAREHOUSE p group by WS_SKU_ID";
        //计算结束行
        int m=i+j;
        //分组分页查询
        String sqlString="select * from

(SELECT rownum as rn, a.* FROM (select WS_SKU_ID,sum(IN_NUMBER),sum(WH_MONEY) from IN_WAREHOUSE p group by WS_SKU_ID ) a)

where rn>"+i+" and rn<="+m+"";


        List trList = this.excuteSql(sqlString, "inreport");
        List clist = this.excuteSql(countquery, "count");
        int totalProperty = clist.size();
        Map map = new HashMap();
        map.put(TOTAL_PROPERTY, totalProperty);
        map.put(BUSI_LIST, trList);
        return map;
    }

文章来自:http://www.cnblogs.com/lengzhijun/p/4383397.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3