‎08-26-2019 04:48 PM
‎08-26-2019 05:50 PM
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
softwareX.softwareName AS X_name,
softwareX.softwareVersion AS X_version,
softwareY.softwareName AS Y_name,
softwareY.softwareVersion AS Y_version
From
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblComputerSystem On tblComputerSystem.AssetID = tblAssets.AssetID
Left Join (Select tblSoftware.AssetID,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion
From tblSoftware
Inner Join tblSoftwareUni On tblSoftwareUni.SoftID = tblSoftware.softID
Where tblSoftwareUni.softwareName = 'software_x'
And tblSoftware.softwareVersion = 'software_x_version') AS softwareX On softwareX.AssetID = tblAssets.AssetID
Left Join (Select tblSoftware.AssetID,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion
From tblSoftware
Inner Join tblSoftwareUni On tblSoftwareUni.SoftID = tblSoftware.softID
Where tblSoftwareUni.softwareName = 'software_y'
And tblSoftware.softwareVersion = 'software_y_version') AS softwareY On softwareY.AssetID = tblAssets.AssetID
Where
tblAssetCustom.State = 1 -- active
AND tblAssets.AssetType = -1 -- Windows machines
AND tblComputerSystem.Domainrole <= 1 -- workstations
AND softwareX.AssetID IS NOT NULL -- software X found
AND softwareY.AssetID IS NULL -- software Y not found
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now