→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎01-02-2020 04:43 PM
‎01-21-2020 09:45 PM
Select Top 1000000
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.AssetID,
tblAssetCustom.PurchaseDate As [Purchase Date],
Year(tblAssetCustom.PurchaseDate) As [Purchase Year],
Year(tblAssetCustom.PurchaseDate) + 5 As [Q Refresh Yr.],
tblAssetCustom.Model,
tblAssets.Memory,
tblAssets.Description,
tblAssets.AssetName,
tsysIPLocations.IPLocation,
tblAssetCustom.Warrantydate As [Warranty Expiration],
tblAssetCustom.Manufacturer,
tsysAssetTypes.AssetTypename As Type,
Case
When tblAssetCustom.Manufacturer Like 'Microsoft%' And tblAssetCustom.Model Like 'Surface%' Then 'Tablet'
When tblPortableBattery.Name Is Not Null Then 'Laptop'
Else TsysChassisTypes.ChassisName
End As Chassis
From
tblAssetCustom
Inner Join tblAssets On tblAssetCustom.AssetID = tblAssets.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tsysIPLocations On tblAssets.LocationID = tsysIPLocations.LocationID
Left Join tblPortableBattery On tblAssets.AssetID = tblPortableBattery.AssetID
Left Join (Select Distinct
tblSystemEnclosure.AssetID,
tblSystemEnclosure.ChassisTypes
From tblSystemEnclosure
WHERE tblSystemEnclosure.ChassisTypes <> 12 -- no docking stations
) AS Enclosure ON Enclosure.AssetID = tblAssets.AssetID
Left Join TsysChassisTypes On Enclosure.ChassisTypes = TsysChassisTypes.Chassistype
Where
tblAssetCustom.State = 1
And tblAssets.Assettype <> 66
And ( tblAssetCustom.Warrantydate < GetDate()
Or tblAssetCustom.PurchaseDate Is Null
)
Order By
[Warranty Expiration] Desc
SELECT *
FROM tsysAssetTypes
And tsysAssetTypes.AssetTypename IN ('Windows', 'Linux', 'Unix', 'Macintosh')or
will do the same thing, for example.
And tblAssets.Assettype IN (-1, 11, 12, 13)
‎01-21-2020 06:58 PM
‎01-20-2020 08:21 PM
WHERE
DateDiff(d, tblAssetCustom.PurchaseDate, GetDate()) > (5 * 365.25)
OR tblAssetCustom.PurchaseDate IS NULL
Year(tblAssetCustom.PurchaseDate) + 5for example, would output 5 + the year recorded in the purchase date field. If you want something more refined than that, look up the DateAdd() function.
‎01-20-2020 07:25 PM
‎01-07-2020 05:58 PM
WHERE
DateDiff(d, tblAssetCustom.PurchaseDate, GetDate()) > (5 * 365.25)
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now