Hi there,
I would like to know if anyone knows a way to solve the problem below with a SQL/PLSQL.
I have group1 and group2 both are interrelated:
The idea is to start from this dataset:
WITH T AS
(
SELECT 'A' AS GROUP1, 100 AS GROUP2 FROM DUAL UNION
SELECT 'A' AS GROUP1, 101 AS GROUP2 FROM DUAL UNION
SELECT 'B' AS GROUP1, 100 AS GROUP2 FROM DUAL UNION
SELECT 'B' AS GROUP1, 102 AS GROUP2 FROM DUAL UNION
SELECT 'C' AS GROUP1, 103 AS GROUP2 FROM DUAL UNION
SELECT 'C' AS GROUP1, 104 AS GROUP2 FROM DUAL UNION
SELECT 'D' AS GROUP1, 101 AS GROUP2 FROM DUAL UNION
SELECT 'E' AS GROUP1, 104 AS GROUP2 FROM DUAL UNION
SELECT 'F' AS GROUP1, 105 AS GROUP2 FROM DUAL
)
SELECT * FROM T;
Expected OUPUT:

This seems to me like something that could be solved with a hierarchical query, but I could not get my head around it to solve the problem.
Hope one of you guys can help me on this.
Cheers.