‎10-01-2020 09:07 AM
Select Top 10000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tsysCurrentScans.ScanType,
Count(tsysCurrentScans.ScanType) As Num
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join tsysASServers On tsysASServers.Servername = tblAssets.AssetName
Inner Join tsysCurrentScans On tsysASServers.Servername =
tsysCurrentScans.Scanserver
Where tsysCurrentScans.ScanType = 1 And tsysASServers.Servicelastpolled >
GetDate() - 7 And tblAssetCustom.State = 1 And Not Exists(Select Top
10000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tsysCurrentScans.ScanType
From tblAssets Inner Join tblAssetCustom On tblAssets.AssetID =
tblAssetCustom.AssetID Inner Join tsysOS On tsysOS.OScode =
tblAssets.OScode Inner Join tsysASServers On
tsysASServers.Servername = tblAssets.AssetName Inner Join
tsysCurrentScans On tsysASServers.Servername =
tsysCurrentScans.Scanserver
Where tsysCurrentScans.ScanType = 2 And tsysASServers.Servicelastpolled >
GetDate() - 7 And tblAssetCustom.State = 1)
Group By tsysOS.Image,
tblAssets.AssetID,
tblAssets.AssetName,
tsysCurrentScans.ScanType
Having Count(tsysCurrentScans.ScanType) > 199
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now