3
Answers

How to select parent ids

Bhupendra Singh

Bhupendra Singh

10y
1.2k
1

I have table with such structure.

ElementId |  ParentId
-------------------
1         | NULL
2         | 1
3         | 2
4         | 3

Let say current element has Id 4. I want to select all parent ids. Result should be: 3, 2, 1

Answers (3)