cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
C_C
Engaged Sweeper II
Help please,

I need a report that when I filter by the manager shows all staff that are managed by the manager.
along with this I want it to show the devices that are associated to the staff member.
I have managed to produce Staff to managers and then tried adding the devices but it does not work correctly.

Any help will be appreciated.

Code:

Select Top 1000000 tblADusers.Username As [User LID],
tblADusers.Displayname,
tblADusers.email As Email,
tsysIPLocations.IPLocation As [Building Location],
tblAssets.AssetName,
tblAssets.AssetID,
tblAssetCustom.Model,
tblAssets.Lastseen,
tblADObjects.sAMAccountName As [Manager LID],
Manager.Displayname As [Manager Name],
Manager.email As [Manager email]
From tblADusers
Left Join tblADObjects On
tblADObjects.ADObjectID = tblADusers.ManagerADObjectId
Inner Join tblADusers Manager On tblADObjects.ADObjectID = Manager.ADObjectID
Left Join tblAssets On tblAssets.Username = tblADusers.Username And
tblAssets.Userdomain = tblADusers.Userdomain
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysIPLocations On tsysIPLocations.LocationID =
tblAssets.LocationID
0 REPLIES 0