LISTAGG row_number 各科成绩前5名

SELECT F_PROJECT_ID, F_PROJECT_NAME,
LISTAGG(USR_CAPTION||'('||F_USER||')['||F_GS ||']',',') WITHIN GROUP(ORDER BY F_GS ) F_PROJECT_ID 
--OVER (PARTITION BY HH.F_PROJECT_ID)
 FROM (
select HH.F_PROJECT_ID,IP.F_PROJECT_NAME, 
HH.F_USER,UR.USR_CAPTION,UR.USR_PHONE1, HH.F_GS, HH.PM 
from (
select  t.*,row_number() over(partition by t.F_PROJECT_ID order by t.F_GS desc) pm from V_PRJ_USR_GS t
) HH 
LEFT JOIN IC_PROJECT_STO IP ON HH.F_PROJECT_ID=IP.F_PROJECT_ID
LEFT JOIN  SSF_USERS UR ON  UR.USR_USRID=HH.F_USER
AND pm<6) TT

GROUP BY F_PROJECT_ID, F_PROJECT_NAME

你可能感兴趣的:(LISTAGG row_number 各科成绩前5名)