‎12-04-2018 04:23 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
Case
When tblADComputers.Description Like '%DC1%' Then 'DC1'
When tblADComputers.Description Like '%DC2%' Then 'DC2'
When tblADComputers.Description Like '%PH1%A/A%' Then 'Phase 1 A/A'
When tblADComputers.Description Like '%PH1%A/M%' Then 'Phase 1 A/M'
When tblADComputers.Description Like '%PH2%A/M%' Then 'Phase 2 A/M'
When tblADComputers.Description Like '%PH2%A/A%' Then 'Phase 2 A/A'
When tblADComputers.Description Like '%PH3%A/M%' Then 'Phase 3 A/M'
When tblADComputers.Description Like '%PH3%A/A%' Then 'Phase 3 A/A'
When tblADComputers.Description Like '%PH4%A/M%' Then 'Phase 4 A/M'
When tblADComputers.Description Like '%PH4%A/A%' Then 'Phase 4 A/A'
When tblADComputers.Description Like '%PH4%M/M%' Then 'Phase 4 M/M'
Else 'Phase UNKNOWN'
End As 'Patching Phase',
tsysIPLocations.IPLocation,
tsysOS.OSname + ' SP' + Convert(VARCHAR,tblAssets.SP) As 'Operating System',
tblAssets.IPAddress,
tblAssetCustom.Custom1 As Purpose,
tblAssetCustom.Custom2 As 'Business Owner',
tblAssetCustom.Custom3 As 'IT Owner'
From tblAssets
Left Join tsysIPLocations On tblAssets.IPNumeric >= tsysIPLocations.StartIP
And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Left Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Left Join tblOperatingsystem On tblAssets.AssetID = tblOperatingsystem.AssetID
Where tblOperatingsystem.Caption Like '%server%'
Order By tblAssets.AssetName
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.IPAddress,
tblAssets.Domain,
Case
When tblADComputers.Description Like '%DC1%' Then 'DC1'
When tblADComputers.Description Like '%DC2%' Then 'DC2'
When tblADComputers.Description Like '%PH1%A/A%' Then 'Phase 1 A/A'
When tblADComputers.Description Like '%PH1%A/M%' Then 'Phase 1 A/M'
When tblADComputers.Description Like '%PH2%A/M%' Then 'Phase 2 A/M'
When tblADComputers.Description Like '%PH2%A/A%' Then 'Phase 2 A/A'
When tblADComputers.Description Like '%PH3%A/M%' Then 'Phase 3 A/M'
When tblADComputers.Description Like '%PH3%A/A%' Then 'Phase 3 A/A'
When tblADComputers.Description Like '%PH4%A/M%' Then 'Phase 4 A/M'
When tblADComputers.Description Like '%PH4%A/A%' Then 'Phase 4 A/A'
When tblADComputers.Description Like '%PH4%M/M%' Then 'Phase 4 M/M'
Else 'Phase UNKNOWN'
End As 'Patching Phase',
tsysIPLocations.IPLocation,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblLinuxSystem.OSRelease,
tblLinuxSystem.OperatingSystem,
tblOperatingsystem.Caption
From tblAssets
Left Join tsysIPLocations On tblAssets.IPNumeric >= tsysIPLocations.StartIP
And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Left Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Left Join tblOperatingsystem On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblLinuxSystem On tblAssets.AssetID = tblLinuxSystem.AssetID
Where OSRelease like '%Red%Hat%' OR tblOperatingsystem.Caption Like '%server%'
Solved! Go to Solution.
‎12-05-2018 08:50 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
Case
When tblADComputers.Description Like '%DC1%' Then 'DC1'
When tblADComputers.Description Like '%DC2%' Then 'DC2'
When tblADComputers.Description Like '%PH1%A/A%' Then 'Phase 1 A/A'
When tblADComputers.Description Like '%PH1%A/M%' Then 'Phase 1 A/M'
When tblADComputers.Description Like '%PH2%A/M%' Then 'Phase 2 A/M'
When tblADComputers.Description Like '%PH2%A/A%' Then 'Phase 2 A/A'
When tblADComputers.Description Like '%PH3%A/M%' Then 'Phase 3 A/M'
When tblADComputers.Description Like '%PH3%A/A%' Then 'Phase 3 A/A'
When tblADComputers.Description Like '%PH4%A/M%' Then 'Phase 4 A/M'
When tblADComputers.Description Like '%PH4%A/A%' Then 'Phase 4 A/A'
When tblADComputers.Description Like '%PH4%M/M%' Then 'Phase 4 M/M'
Else 'Phase UNKNOWN'
End As 'Patching Phase',
tsysIPLocations.IPLocation,
case when (OSRelease like '%Red%Hat%' OR OSRelease like '%ORACLE%' OR OSRelease like '%Debian%') then tbllinuxsystem.OSRelease
else tsysOS.OSname + ' SP' + Convert(VARCHAR,tblAssets.SP)
end As 'Operating System',
tblAssets.IPAddress,
tblAssetCustom.Custom1 As Purpose,
tblAssetCustom.Custom2 As 'Business Owner',
tblAssetCustom.Custom3 As 'IT Owner'
From tblAssets
Left Join tsysIPLocations On tblAssets.IPNumeric >= tsysIPLocations.StartIP
And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Left Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Left Join tblOperatingsystem On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
left outer Join tblLinuxSystem On tblAssets.AssetID = tblLinuxSystem.AssetID
Where (OSRelease like '%Red%Hat%' OR OSRelease like '%ORACLE%' OR OSRelease like '%Debian%' OR tblOperatingsystem.Caption Like '%server%')
Order By tblAssets.AssetName
‎12-05-2018 08:50 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
Case
When tblADComputers.Description Like '%DC1%' Then 'DC1'
When tblADComputers.Description Like '%DC2%' Then 'DC2'
When tblADComputers.Description Like '%PH1%A/A%' Then 'Phase 1 A/A'
When tblADComputers.Description Like '%PH1%A/M%' Then 'Phase 1 A/M'
When tblADComputers.Description Like '%PH2%A/M%' Then 'Phase 2 A/M'
When tblADComputers.Description Like '%PH2%A/A%' Then 'Phase 2 A/A'
When tblADComputers.Description Like '%PH3%A/M%' Then 'Phase 3 A/M'
When tblADComputers.Description Like '%PH3%A/A%' Then 'Phase 3 A/A'
When tblADComputers.Description Like '%PH4%A/M%' Then 'Phase 4 A/M'
When tblADComputers.Description Like '%PH4%A/A%' Then 'Phase 4 A/A'
When tblADComputers.Description Like '%PH4%M/M%' Then 'Phase 4 M/M'
Else 'Phase UNKNOWN'
End As 'Patching Phase',
tsysIPLocations.IPLocation,
case when (OSRelease like '%Red%Hat%' OR OSRelease like '%ORACLE%' OR OSRelease like '%Debian%') then tbllinuxsystem.OSRelease
else tsysOS.OSname + ' SP' + Convert(VARCHAR,tblAssets.SP)
end As 'Operating System',
tblAssets.IPAddress,
tblAssetCustom.Custom1 As Purpose,
tblAssetCustom.Custom2 As 'Business Owner',
tblAssetCustom.Custom3 As 'IT Owner'
From tblAssets
Left Join tsysIPLocations On tblAssets.IPNumeric >= tsysIPLocations.StartIP
And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Left Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Left Join tblOperatingsystem On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
left outer Join tblLinuxSystem On tblAssets.AssetID = tblLinuxSystem.AssetID
Where (OSRelease like '%Red%Hat%' OR OSRelease like '%ORACLE%' OR OSRelease like '%Debian%' OR tblOperatingsystem.Caption Like '%server%')
Order By tblAssets.AssetName
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now