I am new to postgres.
My postgres table name is Employee consisting of following columns
1.empid(uuid)//unique id
2.name
3.designation('engineer', 'asst.engineer', 'hr')
4.reporting_available('yes','no')
5.reporting_to('emp ids')//mapping to another employee
if suppose in organisation employee structure is like in below image
I need query for getting the hierarchy of jenny till reporting available (no)
Expected output
Jenny -> Sam -> Uday -> Sanjay.
Since sanjay dont report to anyone we should stop hierarchy at sanjay.
The similar questions
Postgres query to get all the children ids
SQL query to get the list of supervisor hierarchy. employee --> supervisor --> supervisor
did not have answer related to my question