SQL Server - Heirarchy Question
Posted on 2009-04-08
I have a table called "Customer" and this table has a few fields CustID and CustParentID, I need to pull together the heirarchy of the parent and child customers based on a passed custid, if the custparentid is null then it is a top level parent for example:
Now I may pass to a proc custif 345. I want a resultset the best way I can get it to show the display order I am going to show the results of the parent and childs so maybe something returned such as:
Can anyone help the best way I can do this, or a better way possibly?