Here is the table:
CREATE TABLE test_table ( id integer not null, name char(1) not null, parent_id integer, sum integer not null); INSERT INTO test_table VALUES(1, 'A', null, 300); INSERT INTO test_table VALUES(11, 'B', 1, 2340); INSERT INTO test_table VALUES(111, 'C', 11, 3200); INSERT INTO test_table VALUES(22, 'D', 1, 7540); INSERT INTO test_table VALUES(2, 'E', null, 6300); INSERT INTO test_table VALUES(3, 'F', 2, 8600); INSERT INTO test_table VALUES(101, 'G', 3, 3800); INSERT INTO test_table VALUES(102, 'H', 3, 9700);` Here is the code:
SELECT sys_connect_by_path(name, ',') as Common FROM test_table START WITH parent_id is null CONNECT BY PRIOR id = parent_id` It gives hierarchical nesting of names. How to change the code so that it shows only those lines that have parent_id , while only the name parent_id , excluding the line id ?
WHERE level>1- Mike