I have table as
I want to create SQl or Procedure to fetch values as below
FolderPath LeafFolderID
Dept/CSE/Cfolder 100
Dept/Mech 10
Team/HR 22
Settlement 3
Please let me know how to achieve this?