I have a table with an id column and a parent_id column. The parent_id column refers to another rows id column in the same table.
Something like ...
ID | PARENT_ID
---|----------
1 | null
2 | 1
3 | 2
Is there a way with one select statement when given an id to get all the parent ids? So if given 3 it will return 2 and 1?
I hope the question is clear ...
thanks ...
Something like ...
ID | PARENT_ID
---|----------
1 | null
2 | 1
3 | 2
Is there a way with one select statement when given an id to get all the parent ids? So if given 3 it will return 2 and 1?
I hope the question is clear ...
thanks ...