cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Lakatta
Engaged Sweeper III
Hello there.

I created a report a while ago to get a list of computers and display what ou they are in as one of the fields in the report.

The report is morphing into a show all computers that do not have certain letters in the name, and belong to specific OU's like. I cannot seem to get the like OU's part correct. I've done some searching on the net and cannot find a good example to make it work. Below is the report with the incorrect OU's like. Any direction or help is appreciated.


Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblADComputers.OU,
tblAssets.Lastseen,
tblAssetCustom.Building,
tblAssetCustom.Department,
tblAssets.Description,
tblADusers.Username,
tblADusers.Displayname,
tblADusers.Telephone,
tblADusers.email,
tblAssets.Version,
tblAssetCustom.Model,
tblOperatingsystem.Caption
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join tblADusers On tblADusers.Username = tblAssets.Username
Inner Join tblOperatingsystem On
tblAssets.AssetID = tblOperatingsystem.AssetID
Where tblAssets.AssetName Not Like '%spr%' And tblAssets.AssetName Not
Like '%wv%' And tblAssets.AssetName Not Like '%win%' And
tblAssets.AssetName Not Like '%cli%' And tblADComputers.OU Like '%ou1%' And
tblADComputers.OU Like '%ou2%' And tblADComputers.OU Like '%ou3%' And
tblAssetCustom.State = 1
2 REPLIES 2
Lakatta
Engaged Sweeper III
Fantastic! Works like a charm. Thank you for your help.
RCorbeil
Honored Sweeper II
I'm not sure I'm interpreting what you're looking for correctly, but try this:
Where
tblAssetCustom.State = 1
And tblAssets.AssetName Not Like '%spr%'
And tblAssets.AssetName Not Like '%wv%'
And tblAssets.AssetName Not Like '%win%'
And tblAssets.AssetName Not Like '%cli%'
And ( tblADComputers.OU Like '%ou1%'
Or tblADComputers.OU Like '%ou2%'
Or tblADComputers.OU Like '%ou3%'
)
That should list computers where the OU matches any of the three you've listed.