Hey there, Hopefully someone has a sec to help me out. I have a pretty tough query here for ya.

I want to turn this:

Parent | Child
Fred | Mark
John | Cindy
Mark | John
John | Suzy

into this:

Ancestor | Level | Descendant
Fred | 1 | Mark
Fred | 2 | John
Fred | 3 | Cindy
Fred | 3 | Suzy
Mark | 1 | John
Mark | 2 | Cindy
Mark | 2 | Suzy
John | 1 | Cindy
John | 1 | Suzy

I want to do this in a single select statement. No loops or cursors. Please tell me you are as stumped as I am so that I don't feel so dumb.

Thanks,
Jason
SQL DBA/MCSE