WITH A AS (
SELECT 1123 ID,'2008-9-19' DAY,'9:7:47' TIME FROM DUAL UNION
SELECT 1123 ID,'2008-9-19' DAY,'19:7:47' TIME FROM DUAL UNION
SELECT 1123 ID,'2008-9-19' DAY,'13:7:47' TIME FROM DUAL UNION
SELECT 1123 ID,'2008-9-19' DAY,'12:7:47' TIME FROM DUAL )
select ID,DAY,MAX(SYS_CONNECT_BY_PATH(TIME,',')) TIME FROM
(SELECT ID,DAY,TIME,ROW_NUMBER()OVER(PARTITION BY ID,DAY ORDER BY ID ) RN FROM A)
START WITH RN=1
CONNECT BY RN-1=PRIOR RN
GROUP BY ID,DAY
Oracle行合并的例子,很值得学习
最新推荐文章于 2024-07-10 19:28:33 发布