‎03-16-2021 09:21 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
DatePart(yyyy, tblAssetCustom.Custom5) As Year,
tblAssetCustom.Comments As Usage,
tblAssetCustom.Custom2 As Size,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate,
tblState.Statename,
tblAssetUserRelations.Comments
From tblAssets
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblAssetUserRelations On
tblAssets.AssetID = tblAssetUserRelations.AssetID
Left Join tblState On tblState.State = tblAssetCustom.State
Left Outer Join tblADusers On
tblADusers.Userdomain = tblAssetUserRelations.Userdomain And
tblADusers.Username = tblAssetUserRelations.Username
Where (tblAssetUserRelations.StartDate Is Null And tblAssets.Assettype = 208) Or
(Not tblAssetUserRelations.StartDate Is Null And tblAssets.Assettype = 208 And
Not tblAssetUserRelations.EndDate Is Null)
Order By Year Desc,
tblAssets.AssetName
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now