Hi,
We have report that lists all our assets and their owners and assets without owner. But we would need a report that lists only users who has ownership on two or more asset, Any ideas how it's done?
Select Top 1000000 tblAssets.AssetName,
tblAssets.AssetID,
tblADusers.Name As Owner,
tblADusers.Company,
tblADusers.Department As Unit,
tblADusers.Description As Team,
tblADusers.EmployeeID As CostCenter,
tblADusers.City,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.Warrantydate,
tblAssets.Lastseen
From tblAssets
Left Join (Select tblAssetUserRelations.AssetID,
tblAssetUserRelations.Username,
tblAssetUserRelations.Userdomain
From tblAssetUserRelations
Where tblAssetUserRelations.Type = 1) tOwnerRelations On tblAssets.AssetID =
tOwnerRelations.AssetID
Left Join tblADusers On tblADusers.Username = tOwnerRelations.Username And
tblADusers.Userdomain = tOwnerRelations.Userdomain
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID And
tblAssets.AssetID = tblAssetCustom.AssetID
Where tblAssetCustom.Model Not Like '%Virtual%' And
tblAssets.Assettype Like '-1' And tblAssetCustom.State = 1
Order By Owner