I was wondering if anyone has any sql code samples where they have had to flatten a hierarchy of nodes without the use of a CTE.
For example, consider an organizational hierarchy tree with the CEO is at the top and all levels of management down to the lowest levels.
So, if the structure of the data was like this:
employeeid, bossid, employeename, employeetitle where the CEO would have bossid = null, but every other bossid would connect employee to the his/her boss,
I would want the output to be:
John Doe, CEO, ~ Jane Smith, VP Engineering ~ Jacob Crowley, Engineering Manager ~ Jen Stein, Engineer
John Doe, CEO, ~ Don Young, VP Sales ~ Susan White, Sales Manager ~ Joyce Abram, Sales