‎05-05-2015 01:29 PM
Solved! Go to Solution.
‎05-05-2015 03:25 PM
Select Top 1000000 tblADusers.Displayname,
tblADusers.Firstname,
tblADusers.Lastname,
tblADusers.Department,
tblADusers.Office,
tblADusers.Description,
tblADusers.whenCreated,
tblAssets.AssetID,
tblAssets.AssetName,
tLastLogon.[last logon]
From tblADusers
Left Join (Select Max(tblCPlogoninfo.logontime) As [last logon],
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
tblCPlogoninfo.AssetID
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
tblCPlogoninfo.AssetID) tLastLogon On tblADusers.Username =
tLastLogon.Username And tblADusers.Userdomain = tLastLogon.Domain
Left Join tblAssets On tLastLogon.AssetID = tblAssets.AssetID
Order By tblADusers.Displayname
‎06-05-2015 02:50 PM
Select Top 1000000 tblADusers.Displayname,
tblADusers.Firstname,
tblADusers.Lastname,
tblADusers.Department,
tblADusers.Office,
tblADusers.Description,
tblADusers.whenCreated,
tblAssets.AssetID,
tblAssets.AssetName,
tLastLogon.[last logon]
From tblADusers
Left Join (Select Max(tblCPlogoninfo.logontime) As [last logon],
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) tLastLogon On tblADusers.Username =
tLastLogon.Username And tblADusers.Userdomain = tLastLogon.Domain
Left Join (Select tblCPlogoninfo.logontime As [last logon],
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
tblCPlogoninfo.AssetID
From tblCPlogoninfo) tLogonAsset On tLogonAsset.[last logon] =
tLastLogon.[last logon] And tLogonAsset.Username = tblADusers.Username And
tLogonAsset.Domain = tblADusers.Userdomain
Left Join tblAssets On tLogonAsset.AssetID = tblAssets.AssetID
Order By tblADusers.Displayname
‎03-26-2020 05:18 PM
Daniel.B wrote:
The following report lists only the last logon which was scanned by Lansweeper for each user.
Select Top 1000000 tblADusers.Displayname,
tblADusers.Firstname,
tblADusers.Lastname,
tblADusers.Department,
tblADusers.Office,
tblADusers.Description,
tblADusers.whenCreated,
tblAssets.AssetID,
tblAssets.AssetName,
tLastLogon.[last logon]
From tblADusers
Left Join (Select Max(tblCPlogoninfo.logontime) As [last logon],
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) tLastLogon On tblADusers.Username =
tLastLogon.Username And tblADusers.Userdomain = tLastLogon.Domain
Left Join (Select tblCPlogoninfo.logontime As [last logon],
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
tblCPlogoninfo.AssetID
From tblCPlogoninfo) tLogonAsset On tLogonAsset.[last logon] =
tLastLogon.[last logon] And tLogonAsset.Username = tblADusers.Username And
tLogonAsset.Domain = tblADusers.Userdomain
Left Join tblAssets On tLogonAsset.AssetID = tblAssets.AssetID
Order By tblADusers.Displayname
‎06-05-2015 11:41 AM
‎05-05-2015 03:25 PM
Select Top 1000000 tblADusers.Displayname,
tblADusers.Firstname,
tblADusers.Lastname,
tblADusers.Department,
tblADusers.Office,
tblADusers.Description,
tblADusers.whenCreated,
tblAssets.AssetID,
tblAssets.AssetName,
tLastLogon.[last logon]
From tblADusers
Left Join (Select Max(tblCPlogoninfo.logontime) As [last logon],
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
tblCPlogoninfo.AssetID
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
tblCPlogoninfo.AssetID) tLastLogon On tblADusers.Username =
tLastLogon.Username And tblADusers.Userdomain = tLastLogon.Domain
Left Join tblAssets On tLastLogon.AssetID = tblAssets.AssetID
Order By tblADusers.Displayname
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now