oracle的数据库,随笔

不多说,看代码

select b.*,a.kscj,a.paiming from (select t.kch,t.kcm,t.kscj,t.xh,
        rank() over (order by t.kscj desc) paiming //排名用的
        from CJ_LRCJB t where t.kch=#{kch}
        order by kscj desc) a,(select t.kch,t.kcm,count(kscj) as total,max(kscj) as max_score,min(kscj) as min_score from (select
        t.kch,t.kcm,t.kscj from CJ_LRCJB t where t.kch=#{kch}
        order by kscj desc) t
        group by t.kch,t.kcm) b where a.kch=b.kch and a.kcm=b.kcm and xh=#{xh}

posted @ 2015-04-28 18:05  花语苑  阅读(131)  评论(0编辑  收藏  举报