oracle 分组 row_number()

create or replace view vw004_examineegrade as
select "EGID","USERID","TPID","WLGID","EXTIMES","EXSTATE","EXB_TIME",
   "EXE_TIME","TESTTIME","OBJECTIVE","SUBJECTIVE",round(nvl(EXSCORE,0),1) as EXSCORE,"PFUSERID",
   "EXREMARK" from
   (
   select tbexamineegrade.*,
   row_number() over(partition by userid,TpID order by exscore desc) lev
   from tbexamineegrade where exstate=5  )
   where lev=1
-------------------------------------------------------------------

select tbexamineegrade.*,
   row_number() over( partition by userid,TpID order by exscore desc ) lev


   from tbexamineegrade where exstate=5;

按partition by userid,TpID进行 分组,按 exscore 进行排序

------------------------------------------------------------------

今天是10月10号 好久没有记日志了

你可能感兴趣的:(row_number())