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