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 |
bobbyjha555
Starting Member
1 Post |
Posted - 2014-01-05 : 18:45:54
|
Hi,I have a table which has 2 columns and many rows (below is a example : original table has around ~2k lines in it ).2 columns are user managerEG :john peterjoe petersam peterjill boydrav boydvenkat rajsurku rajdomc joehans joejeen ravpam surkuharry domcI need to have a script which can give me output which will have directreport till 2 level deep ( Ignore anything which is more than 2 levels deep )manager, directreport, directreport1, directreport2, directmanager1, directmanager2so for abovve the output should bepeter john null null null nullpeter joe null null null nullpeter sam null null null nullpeter null domc null joe nullpeter null hans null joe nullpeter null null harry null domcboyd jill null null null nullboyd rav null null null nullboyd null jeen null rav nullraj venkat null null null nullraj surku null null null null joe domc null null null nulljoe hans null null null nulljoe null harry null domc nullrav jean null null null nullsurku pam null null null nulldomc harry null null null nullRegardsBobbyBobbyJha |
|
lohumi
Starting Member
6 Posts |
|
|
|
|