‎02-01-2016 04:34 PM
Solved! Go to Solution.
‎02-21-2016 05:41 PM
Select Top 1000000 tblADusers.Username As Manager,
tblADusers.Userdomain As ManagerDomain,
tblADusers1.Username As DirectReportLevel1,
tblAssets.AssetID,
tblAssets.AssetName As Lvl1Asset,
tblAssets.Domain As Lvl1Domain,
tblAssetCustom.PurchaseDate As Lvl1PurchaseDate,
tblAssetCustom.Warrantydate As Lvl1WarrantyDate,
tblADusers2.Username As DirectReportLevel2,
tblAssets1.AssetName As Lvl2Asset,
tblAssets1.Domain As Lvl2Domain,
tblAssetCustom1.PurchaseDate As Lvl2PurchaseDate,
tblAssetCustom1.Warrantydate As Lvl2WarrantyDate
From tblADusers
Left Join tblADusers tblADusers1 On tblADusers.ADObjectID =
tblADusers1.ManagerADObjectId
Left Join tblAssets On tblAssets.Username = tblADusers1.Username And
tblAssets.Userdomain = tblADusers1.Userdomain
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADusers tblADusers2 On tblADusers1.ADObjectID =
tblADusers2.ManagerADObjectId
Left Join tblAssets tblAssets1 On tblAssets1.Username = tblADusers2.Username
And tblAssets1.Userdomain = tblADusers2.Userdomain
Left Join tblAssetCustom tblAssetCustom1 On tblAssets1.AssetID =
tblAssetCustom1.AssetID
Order By ManagerDomain,
Manager,
DirectReportLevel1,
DirectReportLevel2
‎02-22-2016 02:08 PM
‎02-21-2016 05:41 PM
Select Top 1000000 tblADusers.Username As Manager,
tblADusers.Userdomain As ManagerDomain,
tblADusers1.Username As DirectReportLevel1,
tblAssets.AssetID,
tblAssets.AssetName As Lvl1Asset,
tblAssets.Domain As Lvl1Domain,
tblAssetCustom.PurchaseDate As Lvl1PurchaseDate,
tblAssetCustom.Warrantydate As Lvl1WarrantyDate,
tblADusers2.Username As DirectReportLevel2,
tblAssets1.AssetName As Lvl2Asset,
tblAssets1.Domain As Lvl2Domain,
tblAssetCustom1.PurchaseDate As Lvl2PurchaseDate,
tblAssetCustom1.Warrantydate As Lvl2WarrantyDate
From tblADusers
Left Join tblADusers tblADusers1 On tblADusers.ADObjectID =
tblADusers1.ManagerADObjectId
Left Join tblAssets On tblAssets.Username = tblADusers1.Username And
tblAssets.Userdomain = tblADusers1.Userdomain
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADusers tblADusers2 On tblADusers1.ADObjectID =
tblADusers2.ManagerADObjectId
Left Join tblAssets tblAssets1 On tblAssets1.Username = tblADusers2.Username
And tblAssets1.Userdomain = tblADusers2.Userdomain
Left Join tblAssetCustom tblAssetCustom1 On tblAssets1.AssetID =
tblAssetCustom1.AssetID
Order By ManagerDomain,
Manager,
DirectReportLevel1,
DirectReportLevel2
‎02-03-2016 02:21 PM
Select Top 1000000 tblAssets.AssetName,
tblAssetCustom.Serialnumber,
tblAssetCustom.Warrantydate,
tblADusers.Name As [AD.Username],
tblAssetCustom.Department,
tblAssets.AssetID,
tManager.Username As Manager,
tblAssetCustom.Building,
tblAssets.Lastseen
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tsysIPLocations
On tblAssets.IPNumeric Between tsysIPLocations.StartIP And
tsysIPLocations.EndIP
Left Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Left Join tblComputerSystemProduct On tblAssets.AssetID =
tblComputerSystemProduct.AssetID
Left Join (Select Case When tblComputersystem.Domainrole > 1 Then 'Server'
Else 'Workstation' End As type,
tblComputersystem.AssetID
From tblComputersystem) tComputersystem On tblAssets.AssetID =
tComputersystem.AssetID
Inner Join tblADusers On tblADusers.Username = tblAssets.Username
Left Join tblADusers tManager On tblADusers.ManagerADObjectId =
tManager.ADObjectID
Where tblADusers.Username <> tblAssetCustom.Custom9
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now