have an array with organization data like this:
org_id org_name parent_id
1 Company NULL
2 HR 1
3 MARKETING 2
4 FINANCE 1
5 IT 4
So the structure is:
[Company]
|- HR
| |- MARKETING
|- FINANCE
| |- IT
I'm trying to figure out how I can query which parent organization an organization has for a specific user.
So if a user has defined that they belong to IT I want to match string in org_name and get parent_id. then match parent_id against org_id so in the end get org_name, in this case FINANCE.