→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎08-05-2020 05:24 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssets.Username As [Last Login],
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
Cast(DateDiff(dd, tblAssetCustom.PurchaseDate, GetDate()) / 365.2425
As numeric(8,1)) As Age,
Case
When tblAssetCustom.PurchaseDate Is Null Then '#ff00ff'
When DateAdd(dd, 5 * 365.2425, tblAssetCustom.PurchaseDate) < GetDate() Then
'#ff0000'
End As foregroundcolor,
tblAssetCustom.State
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblAssetGroupLink On tblAssets.AssetID = tblAssetGroupLink.AssetID
Inner Join tblAssetGroups On tblAssetGroups.AssetGroupID =
tblAssetGroupLink.AssetGroupID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where tblAssetGroups.AssetGroup Like 'Human Resources'
Order By tsysAssetTypes.AssetTypename,
tblAssets.AssetName
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblADComputers.Description,
tblAssets.Username As [Last Login],
tblAssetCustom.PurchaseDate,
Cast(DateDiff(dd, tblAssetCustom.PurchaseDate, GetDate()) / 365.2425
As numeric(8,1)) As Age,
Case
When tblAssetCustom.PurchaseDate Is Null Then '#ff00ff'
When DateAdd(dd, 5 * 365.2425, tblAssetCustom.PurchaseDate) < GetDate() Then
'#ff0000'
End As foregroundcolor,
tblAssetCustom.State
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join tblAssetGroupLink On tblAssets.AssetID = tblAssetGroupLink.AssetID
Inner Join tblAssetGroups On tblAssetGroups.AssetGroupID =
tblAssetGroupLink.AssetGroupID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where tblAssetGroups.AssetGroup Like 'Human Resources'
Order By tsysAssetTypes.AssetTypename,
tblAssets.AssetName
‎06-29-2022 11:54 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now