• i want to play with this in detail when i have time, but we had a problem with an app with similar conditions

    we have a table with data and need to return it in hierchial fashion. someone wrote and sp years ago that used a while loop and temp tables. i just rewrote it with a CTE and it seems to run a lot faster