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}

原文地址:https://www.cnblogs.com/zrui-xyu/p/4463703.html