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;
    }

posted on 2015-04-01 11:28  静以修身!  阅读(5975)  评论(0编辑  收藏  举报

导航