WITH PARENT AS ( SELECT 'P1' CD FROM DUAL UNION ALL SELECT 'P2' CD FROM DUAL ) , CHILD AS ( SELECT 'P1' CD , 'DATA1' VAL FROM DUAL UNION ALL SELECT 'P1' CD , 'DATA2' VAL FROM DUAL UNION ALL SELECT 'P1' CD , 'DATA3' VAL FROM DUAL UNION ALL SELECT 'P1' CD , 'DATA4' VAL FROM DUAL UNION ALL SELECT 'P2' CD , 'DATA1' VAL FROM DUAL UNION ALL SELECT 'P2' CD , 'DATA2' VAL FROM DUAL UNION ALL SELECT 'P2' CD , 'DATA3' VAL FROM DUAL UNION ALL SELECT 'P2' CD , 'DATA4' VAL FROM DUAL ) ,LST AS ( SELECT ROW_NUMBER() OVER (PARTITION BY P.CD ORDER BY VAL) AS SEQ ,P.CD ,C.VAL FROM PARENT P ,CHILD C WHERE P.CD =C.CD ) SELECT DECODE(SEQ ,1 , CD , NULL) AS PARENT , VAL FROM LST