Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
harringg
Champion Sweeper
I've got the following union query for Asset Parent-Child relationships. It works fine, however, I'm trying to filter in the query for specific text, instead of post query. As is (without "Where tblAssets_1.AssetName Like 'RSA SecurID-%'", it returns ~1500 assets.

Adding "Where tblAssets_1.AssetName Like 'RSA SecurID-%'" (as shown below) reduces it to ~190 assets, but it's including other assets not part of the where filter.

Is it possible to filter on the "left" side of this union?

Select Top 1000000 *
From (Select tblAssets.AssetID,
tblAssets_1.AssetName As [Asset-User],
tsysAssetRelationTypes.RelationTypeIcon10 As icon,
tblAssetRelations.StartDate,
tsysAssetRelationTypes.Name As RelationType,
tblAssets.AssetName,
tblAssetRelations.Comments
From tblAssets
Inner Join tblAssetRelations
On tblAssets.AssetID = tblAssetRelations.ParentAssetID
Inner Join tsysAssetRelationTypes On tblAssetRelations.Type =
tsysAssetRelationTypes.RelationTypeID
Inner Join tblAssets tblAssets_1 On tblAssetRelations.ChildAssetID =
tblAssets_1.AssetID
Where tblAssets_1.AssetName Like 'RSA SecurID-%'
Union
Select tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetRelationTypes.RelationTypeIcon10 As icon,
tblAssetUserRelations.StartDate,
tsysAssetRelationTypes.Name As RelationType,
tblADusers.Name As [Asset-User],
tblAssetUserRelations.Comments
From tblAssets
Inner Join tblAssetUserRelations On tblAssets.AssetID =
tblAssetUserRelations.AssetID
Inner Join tblADusers On tblAssetUserRelations.Username =
tblADusers.Username And tblAssetUserRelations.Userdomain =
tblADusers.Userdomain
Inner Join tsysAssetRelationTypes On tblAssetUserRelations.Type =
tsysAssetRelationTypes.RelationTypeID) As tbl
Order By tbl.AssetName,
tbl.RelationType
0 REPLIES 0

Archive

This board contains archived posts from the retired Lansweeper Forum and Insiders Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now