WITH T (SEQ, C_CODE, P_CODE, DT) AS ( SELECT '1', 'a000', '0000', '20140101' FROM DUAL UNION ALL SELECT '2', 'a101', 'a000', '20140101' FROM DUAL UNION ALL SELECT '2', 'a102', 'a000', '20140101' FROM DUAL UNION ALL SELECT '3', 'a201', 'a102', '20140102' FROM DUAL ) SELECT * FROM T START WITH DT = '20140102' CONNECT BY PRIOR P_CODE = C_CODE; WITH T (SEQ, C_CODE, P_CODE, DT) AS ( SELECT '1', 'a000', '0000', '20140101' FROM DUAL UNION ALL SELECT '2', 'a101', 'a000', '20140101' FROM DUAL UNION ALL SELECT '2', 'a102', 'a000', '20140101' FROM DUAL UNION ALL SELECT '3', 'a201', 'a102', '20140102' FROM DUAL ) SELECT * FROM T WHERE C_CODE = (SELECT P_CODE FROM T WHERE DT = '20140102');