Howdy all!

Here's a SQL problem that's been vexing me for a few weeks now:

Say you have a table like this:

ID      Name            Boss
1       John            1
2       Mary            2
3       Steve           1
4       Mike            2
5       Susan   3
6       Max             2
7       Michelle        6

So, John is his own boss, the big cheese, and everybody reports to him
or to someone who reports to him, or to someone who reports to someone
who reports to him, etc.
That's the problem - I need to keep it flexible to accommodate any
number of levels because I want to output a tree illustrating the
hierarchy:

-John
---Mary
------Mike
------Max
---------Michelle
---Steve
------Susan

I think I've heard someone talking about "self-joins" but am not sure
how they'd work and whether they'd be flexible enough - anyone have any
ideas?

-Jason
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to