‎11-19-2015 07:49 AM
Solved! Go to Solution.
‎11-23-2015 01:24 PM
Select Top 1000000 tsysIPLocations.IPLocation,
tsysAssetTypes.AssetTypename,
Count(tblAssets.AssetID) As Count
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tsysIPLocations On tsysIPLocations.StartIP <= tblAssets.IPNumeric
And tsysIPLocations.EndIP >= tblAssets.IPNumeric
Where tblAssetCustom.State = 1
Group By tsysIPLocations.IPLocation,
tsysAssetTypes.AssetTypename
Order By tsysIPLocations.IPLocation,
tsysAssetTypes.AssetTypename
‎11-25-2015 07:50 PM
SELECT
AssetTypeName,
[your IP group name 1],
[your IP group name 2],
[your IP group name 3],
[Null]
FROM
( SELECT Top 1000000
IsNull(tsysIPLocations.IPLocation, 'Null') AS IPLocation,
tsysAssetTypes.AssetTypename,
tblAssets.AssetID
FROM
tblAssets
INNER JOIN tblAssetCustom ON tblAssets.AssetID = tblAssetCustom.AssetID
INNER JOIN tsysAssetTypes ON tsysAssetTypes.AssetType = tblAssets.Assettype
LEFT JOIN tsysIPLocations ON tblAssets.IPNumeric >= tsysIPLocations.StartIP And tblAssets.IPNumeric <= tsysIPLocations.EndIP
WHERE
tblAssetCustom.State = 1
) AS pivotSource
PIVOT
( Count(AssetID)
FOR IPLocation IN ([your IP group name 1], [your IP group name 2], [your IP group name 3], [Null])
) AS pivotResult
‎11-25-2015 11:15 AM
‎11-23-2015 03:03 PM
‎11-23-2015 01:24 PM
Select Top 1000000 tsysIPLocations.IPLocation,
tsysAssetTypes.AssetTypename,
Count(tblAssets.AssetID) As Count
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tsysIPLocations On tsysIPLocations.StartIP <= tblAssets.IPNumeric
And tsysIPLocations.EndIP >= tblAssets.IPNumeric
Where tblAssetCustom.State = 1
Group By tsysIPLocations.IPLocation,
tsysAssetTypes.AssetTypename
Order By tsysIPLocations.IPLocation,
tsysAssetTypes.AssetTypename
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now