cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kevinoie
Engaged Sweeper III
Hi,
Is there any way to amend this report to only show the last time the user logged on. In its current format its showing multiple records for each individual user.

Select maxlogon.Latest, tblADusers.Name, tblADusers.Description,
tblADusers.Office, tblADusers.Department
From (Select tblCPlogoninfo.Computername, tblCPlogoninfo.Domain,
tblCPlogoninfo.Username, Max(tblCPlogoninfo.logontime) As Latest
From tblCPlogoninfo
Group By tblCPlogoninfo.Computername, tblCPlogoninfo.Domain,
tblCPlogoninfo.Username) maxlogon Inner Join
tblADusers On maxlogon.Domain = tblADusers.Userdomain And maxlogon.Username =
tblADusers.Username
Order By tblADusers.Name

Many Thanks

Kevin
1 REPLY 1
Hemoco
Lansweeper Alumni
try this

Select maxlogon.Latest, tblADusers.Name, tblADusers.Description,
tblADusers.Office, tblADusers.Department, maxlogon.Domain, maxlogon.Username
From (Select tblCPlogoninfo.Domain, tblCPlogoninfo.Username,
Max(tblCPlogoninfo.logontime) As Latest
From tblCPlogoninfo
Group By tblCPlogoninfo.Domain, tblCPlogoninfo.Username) maxlogon Inner Join
tblADusers On maxlogon.Domain = tblADusers.Userdomain And maxlogon.Username =
tblADusers.Username
Order By tblADusers.Name