‎03-01-2017 06:52 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssetCustom.Custom3 As Company,
tblAssetCustom.Custom2 As Status,
tblAssets.Lastseen,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblState.Statename,
tblADComputers.Location,
tblAssets.Description,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
tblAssetCustom.Manufacturer,
tblADComputers.OU,
tblComputersystem.Domainrole
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join tblState On tblState.State = tblAssetCustom.State
Where (tblAssetCustom.Custom3 Not Like '%companyx%' Or
tblAssetCustom.Custom3 Is Null) And (tblAssetCustom.Custom2 Not Like
'%retired%' Or tblAssetCustom.Custom2 Not Like '%secondary%' Or
tblAssetCustom.Custom2 Is Null) And tblAssetCustom.Model <>
'Virtual Machine' And (tblAssetCustom.Manufacturer Like '%dell%' Or
tblAssetCustom.Manufacturer Like '%microsoft%') And
tblADComputers.OU Not Like '%denver%' And tblComputersystem.Domainrole < 2
Order By tblAssetCustom.PurchaseDate
Solved! Go to Solution.
‎03-02-2017 02:11 PM
‎03-06-2017 07:40 PM
‎03-02-2017 02:11 PM
‎03-01-2017 11:32 PM
WHERE
( tblAssetCustom.Custom3 Not Like '%companyx%'
OR tblAssetCustom.Custom3 Is Null
)
AND ( tblAssetCustom.Custom2 Not Like '%retired%'
OR tblAssetCustom.Custom2 Not Like '%secondary%'
OR tblAssetCustom.Custom2 Is Null
)
AND ( tblAssetCustom.Manufacturer Like '%dell%'
OR tblAssetCustom.Manufacturer Like '%microsoft%'
)
AND tblAssetCustom.Model <> 'Virtual Machine'
AND tblADComputers.OU Not Like '%denver%'
AND tblComputersystem.Domainrole < 2
( tblAssetCustom.Custom2 Not Like '%retired%' => false
OR tblAssetCustom.Custom2 Not Like '%secondary%' => true
OR tblAssetCustom.Custom2 Is Null => false
)
AND (
tblAssetCustom.Custom2 Is Null
OR ( tblAssetCustom.Custom2 Not Like '%retired%'
AND tblAssetCustom.Custom2 Not Like '%secondary%'
)
)
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now