Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
stovan
Starting Member
9 Posts |
Posted - 2009-10-30 : 05:51:38
|
| helloi using sql 2005.i have following table :1> structure table which look like thishierachy_level son father01 01000001 010 01000002 0100000110 01000088 0100000110 01000167 0100000110 01000928 0100000110 01001357 0100000110 01001460 0100000110 01001589 0100000110 01001804 0100000120 01000003 0100000220 01000043 0100000220 01000057 010000022> my second table is just desciption it give example ref desc01000001 MANAGER01000002 OFFICE OF THE MANAGER01000003 GEOGRAPHICAL INFORMATION AND POLICY01000004 PENSIONS01000005 INSURANCE01000006 EXECUTIVE01000007 EXECUTIVE-ELECTRICITY01000008 MONTHLYmy desired output should be likeaaa ba b c ea b c e a b da b d |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-10-30 : 06:00:11
|
how many level do you have ? Is there a maximum ? What if you have 100 level, are you going to show in 100 columns ?Check out the Books Online on Recursive CTE KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
stovan
Starting Member
9 Posts |
Posted - 2009-10-30 : 06:08:31
|
| i tried using the father to son logic but no lucklet me try explain simpleri have employee and this employee belong to a branch and that branch belong to a unit and unit to dept and dept to clustercluster cluster unit deptcluster unit deptif looking from top level - some employee dont have dept (management)and filters down like that |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
stovan
Starting Member
9 Posts |
Posted - 2009-10-30 : 06:57:07
|
| Thank you.This is helping http://www.sqlteam.com/article/more-trees-hierarchies-in-sql |
 |
|
|
|
|
|