I am needing a report that, among other things, lists the last user that logged into the computer and the username. The report I have tried to put to together does everything I need except each login is multiplied 4 or 5 times, all with the same time and date stamp. This morning I just cant seem to figure out why each user name is listed several times for each device. Hopefully someone will see my problem. I am sure it is something obvious I am doing wrong. Here is what I have:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblUsers.UserID,
tblUsers.Disabled,
tblUsers.Fullname,
tblUsers.Name,
tblAssets.Username,
Max(tblCPlogoninfo.logontime) As LastLogon
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Right Join tblUsers On tblAssets.AssetID = tblUsers.AssetID
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Where tblAssetCustom.State = 1
Group By tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblUsers.UserID,
tblUsers.Disabled,
tblUsers.Fullname,
tblUsers.Name,
tblAssets.Username
Any help and advice is appreciated as I am pretty much a SQL beginner. Thanks!