→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎04-04-2022 05:46 PM
Solved! Go to Solution.
‎04-06-2022 02:06 PM
Select Top 1000000 tblassets.AssetName,
tblassets.AssetID,
tsysassettypes.AssetTypeIcon10 As icon,
tblCPlogoninfo.Username,
tblCPlogoninfo.logontime,
tblassets.IPAddress
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join lansweeperdb.dbo.tblCPlogoninfo On tblassets.AssetID =
tblCPlogoninfo.AssetID
Where tblassetcustom.State = 1
‎04-05-2022 12:38 PM
Select Top 1000000 Case
When Row_Number() Over (Partition By tblassets.AssetName Order By
web50repwinuserlogonlast.Username) = 1 Then tblassets.AssetName
Else Null
End As 'Asset Name',
web50repwinuserlogonlast.Username,
tblassets.AssetID,
tsysassettypes.AssetTypeIcon10 As icon,
web50repwinuserlogonlast.UserLastLogon
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join lansweeperdb.dbo.web50repwinuserlogonlast On tblassets.AssetID =
web50repwinuserlogonlast.AssetID
Where tblassetcustom.State = 1
‎04-06-2022 08:13 AM
Andy.S wrote:
This should give you a starting point, this lists each asset and the Users Last logged on :Select Top 1000000 Case
When Row_Number() Over (Partition By tblassets.AssetName Order By
web50repwinuserlogonlast.Username) = 1 Then tblassets.AssetName
Else Null
End As 'Asset Name',
web50repwinuserlogonlast.Username,
tblassets.AssetID,
tsysassettypes.AssetTypeIcon10 As icon,
web50repwinuserlogonlast.UserLastLogon
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join lansweeperdb.dbo.web50repwinuserlogonlast On tblassets.AssetID =
web50repwinuserlogonlast.AssetID
Where tblassetcustom.State = 1
‎04-06-2022 10:25 AM
‎04-06-2022 11:39 AM
Andy.S wrote:
Hi Jonathan, I must be misunderstanding, so that query should do as you ask, with "Asset Name" "User Name" "Last Login", formatted as below, with each asset and the Last Users logged on?
PC12345 User1 , 1/4/2022 12:00:00
__________User2 , 2/4/2022 12:00:00
__________User3 , 3/4/2022 12:00:00
__________User4 , 4/4/2022 12:00:00
PC12346 User7 , 1/4/2022 12:00:00
__________User8 , 1/4/2022 12:00:00
PC12347 User9 , 1/4/2022 12:00:00
LT12386 User , 1/4/2022 12:00:00
__________User1 , 1/4/2022 12:00:00
‎04-06-2022 11:52 AM
Select Top 1000000 tblassets.AssetName,
web50repwinuserlogonlast.Username,
tblassets.AssetID,
tsysassettypes.AssetTypeIcon10 As icon,
web50repwinuserlogonlast.UserLastLogon,
tblassets.IPAddress
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join lansweeperdb.dbo.web50repwinuserlogonlast On tblassets.AssetID =
web50repwinuserlogonlast.AssetID
Where tblassetcustom.State = 1
‎04-06-2022 12:01 PM
Andy.S wrote:
So if you remove the Indent Code, does it work for you now, I think that may be causing the issue ?Select Top 1000000 tblassets.AssetName,
web50repwinuserlogonlast.Username,
tblassets.AssetID,
tsysassettypes.AssetTypeIcon10 As icon,
web50repwinuserlogonlast.UserLastLogon,
tblassets.IPAddress
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join lansweeperdb.dbo.web50repwinuserlogonlast On tblassets.AssetID =
web50repwinuserlogonlast.AssetID
Where tblassetcustom.State = 1
‎04-06-2022 12:37 PM
‎04-06-2022 01:06 PM
Andy.S wrote:
So when I run the report the latest one , and filter down to one VM where multiple User login, its exactly the same list as I see in the Config --> Last Logged On around 30 Users as the report ?
‎04-06-2022 02:06 PM
Select Top 1000000 tblassets.AssetName,
tblassets.AssetID,
tsysassettypes.AssetTypeIcon10 As icon,
tblCPlogoninfo.Username,
tblCPlogoninfo.logontime,
tblassets.IPAddress
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join lansweeperdb.dbo.tblCPlogoninfo On tblassets.AssetID =
tblCPlogoninfo.AssetID
Where tblassetcustom.State = 1
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now