→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎04-30-2014 11:52 AM
Solved! Go to Solution.
‎05-10-2014 01:36 AM
SELECT TOP 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
u.EventTime As LastPowerOn,
DateDiff(d, u.EventTime, GetDate()) As DaysAgo
FROM
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
LEFT JOIN ( SELECT DISTINCT
tblUptime.AssetId,
Max(tblUptime.EventTime) As EventTime,
tblUptime.EventType
FROM
tblUptime
WHERE
tblUptime.AssetID = tblUptime.AssetID
AND tblUptime.EventType = 1
GROUP BY
tblUptime.AssetId,
tblUptime.EventType
) AS u ON u.AssetID = tblAssets.AssetID
WHERE
tblAssetCustom.State = 1
AND tsysAssetTypes.AssetTypename = 'Windows'
‎05-10-2014 01:36 AM
SELECT TOP 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
u.EventTime As LastPowerOn,
DateDiff(d, u.EventTime, GetDate()) As DaysAgo
FROM
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
LEFT JOIN ( SELECT DISTINCT
tblUptime.AssetId,
Max(tblUptime.EventTime) As EventTime,
tblUptime.EventType
FROM
tblUptime
WHERE
tblUptime.AssetID = tblUptime.AssetID
AND tblUptime.EventType = 1
GROUP BY
tblUptime.AssetId,
tblUptime.EventType
) AS u ON u.AssetID = tblAssets.AssetID
WHERE
tblAssetCustom.State = 1
AND tsysAssetTypes.AssetTypename = 'Windows'
‎04-30-2014 06:11 PM
‎04-30-2014 02:09 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now