cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kevinoie
Engaged Sweeper III
Hi. is it possible to add a users last logon time to the following report:

Select Top 1000000 tblADusers.Displayname, tblADusers.Username, tblADusers.Department, tblADusers.Office, tblADusers.Description From tblADusers

I cant seem to find a field for log on.

Any help would be appreciated.

Kev.
4 REPLIES 4
Hemoco
Lansweeper Alumni
try this

Select tblComputers.Computername, tblComputers.ComputerUnique,
tblComputers.Domain, maxlogon.Latest, tblComputers.Userdomain,
tblComputers.Username
From tblComputers Inner Join
(Select tblCPlogoninfo.Computername, tblCPlogoninfo.Domain,
tblCPlogoninfo.Username, Max(tblCPlogoninfo.logontime) As Latest
From tblCPlogoninfo
Group By tblCPlogoninfo.Computername, tblCPlogoninfo.Domain,
tblCPlogoninfo.Username) maxlogon On tblComputers.Userdomain =
maxlogon.Domain And tblComputers.Username = maxlogon.Username
kevinoie
Engaged Sweeper III
Thank you.. Would it be possible to get the full code for this. When I try to add that it hangs on me and wont go any further..

Many thanks again for your support.

Kev
Hemoco
Lansweeper Alumni
you need to the max date value from table tblcplogoninfo.
kevinoie
Engaged Sweeper III
Lansweeper wrote:
you need to the max date value from table tblcplogoninfo.


The MAX DATE value does not exist in the tblcplogoninfo table that I can see. There is a Logon Time Value there, but if I add that then im getting multiple entries for each user....