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 |
kwacz23
Starting Member
44 Posts |
Posted - 2012-11-22 : 14:11:29
|
Hi, I try to build something that can show how is under how in the company. Please find my table belowid Employee id_supirior id_team1 Adrian 10 12 Tomek 1 13 Mirek 1 14 Adam 10 25 Ewa 4 26 Marta 4 27 Iza 10 3 8 Kamil 7 3 9 Hugh 7 310 Martin NUll Null Boss of the whole companySo Martin is the top boss, under Martin we have 3 managers (id=1 Adrian,id=4 Adam, id=7 Iza)under them there is rest of the team. I expect below result:Name count Name count Name Martin 3 Adrian 2 TomekMartin 3 Adrian 2 MirekMartin 3 Adam 2 EwaMartin 3 Adam 2 MartaMartin 3 Iza 2 Kamil Martin 3 Iza 2 Hugh'Count= 3' Martin is Boss for 3 person'Count=2' Adrian and Adam and Iza is boss for 2 person.I hope this make sense. Could you be so kind and help me? Regards |
|
|
|
|