SELECT T.*,ROWNUM ID FROM ( SELECT T.EMPLID, T.NAME, T.BU, T.REAL_DEPART, T.FORMAT_DATE, SUM(T.S0)S0, MAX(UPDATE_TIME)CREATE_TIME, LISTAGG(TO_CHAR(T.STATISTICS_BY), ', ') WITHIN GROUP (ORDER BY T.STATISTICS_BY) AS STATISTICS_BY, LISTAGG(TO_CHAR(T.REMARK), ', ') WITHIN GROUP (ORDER BY T.REMARK) AS REMARK FROM U_SAFETY_PERFORM_SUMMARY T GROUP BY T.EMPLID,T.NAME, T.BU, T.REAL_DEPART,T.FORMAT_DATE )T ORDER BY T.EMPLID ASC, ID ASC
Oracle 分组与拼接字符串同时使用
点赞
收藏