I’m using Firebird 2.1. There is a table name Folders, with the fields:
- FolderID
- ParentFolderID
- FolderName
ParentFolderID is -1 if it’s the root folder — otherwise it contains the parent folder’s ID.
How can I find all parents (up to the root folder) of a low level node?
Do I need a recursive query? (Firebird supports them)
Something like this:
Edit: the following query will walk the hierarchy “up”, finding all parents of a given folder.