We recommend not deleting older asset user relations but rather building a report which lists only the last user which owns one asset. In this way you will keep the history stored in
tblAssetUserRelations. The following report is a modification of the one above which lists only the last "Owned by" relation per asset:
Select Top 1000000 tblAssets.AssetID,
tsysAssetTypes.AssetTypeIcon10 As icon,
tOwner.Username As [Owned by],
tblState.Statename As [Asset state],
tsysAssetTypes.AssetTypename As [Asset type],
Coalesce(tblOperatingsystem.Caption, tblLinuxSystem.OSRelease,
tblMacOSInfo.SystemVersion, 'other/none') As OS,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.Warrantydate As [Warranty expiration],
tblAssets.AssetName,
tblAssets.Lastseen,
tblAssets.Domain,
tblADComputers.OU
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join (Select Max(tblAssetUserRelations.StartDate) As since,
tblAssetUserRelations.AssetID
From tblAssetUserRelations
Where tblAssetUserRelations.Type = 1
Group By tblAssetUserRelations.AssetID) tLastOwner On tblAssets.AssetID =
tLastOwner.AssetID
Left Join (Select tblAssetUserRelations.AssetID,
tblAssetUserRelations.StartDate As since,
tblAssetUserRelations.Username,
tblAssetUserRelations.Userdomain
From tblAssetUserRelations
Where tblAssetUserRelations.Type = 1) tOwner On tLastOwner.AssetID =
tOwner.AssetID And tLastOwner.since = tOwner.since
Inner Join tblState On tblState.State = tblAssetCustom.State
Left Join tblOperatingsystem On tblOperatingsystem.AssetID = tblAssets.AssetID
Left Join tblLinuxSystem On tblAssets.AssetID = tblLinuxSystem.AssetID
Left Join tblMacOSInfo On tblAssets.AssetID = tblMacOSInfo.AssetID
Left Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Where tblAssetCustom.State = 1