firstpic
Above is a given table of data and I need to get the result data like the one below.
secondpic
SELECT ID
FROM
(
SELECT ID, PARENT_ID
FROM ECOLI_DATA
WHERE PARENT_ID IN (SELECT ID FROM ECOLI_DATA WHERE PARENT_ID
IN (SELECT ID FROM ECOLI_DATA WHERE PARENT_ID IS NULL))
) AS aa
ORDER BY 1;
I asked others to get the answer like the code above but I could not figure out the process of this code (subquery part). I figured out what was going on with the first subquery but from the second one, I was lost.
Can someone please explain detailed process? Thank you in advance.
New contributor
DHK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.