I am trying to add the most recent user to the following report for each asset name. It appear the data I want is in tblCPlogoninfo.Username. My problem is this file has multiple entries for each asset name based on the last login time and date so a simple join command does not give me what I need. I am totally clueless on how to build proper SQL queries so I would appreciate anyone willing to revamp this if anyone is game. Thanks in advance.
Select Top 1000000 tblAssetCustom.AssetID,
tblAssets.AssetUnique,
tsysOS.OSname,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber As Serial,
tblAssetCustom.PurchaseDate As [Purchase Date],
tblAssetCustom.Warrantydate As [Warranty Expiration],
tsysOS.Image As icon,
tblAssets.Lastseen
From tblAssetCustom
Inner Join tblAssets On tblAssetCustom.AssetID = tblAssets.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Where (tblAssetCustom.PurchaseDate Is Not Null And tblAssetCustom.State = 1) Or
(tblAssetCustom.Warrantydate Is Not Null And tblAssetCustom.State = 1)
Order By [Warranty Expiration] Desc