‎08-30-2014 01:37 AM
‎09-01-2014 04:57 PM
Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.IPAddress,
tblAssets.Firstseen,
tblAssets.Lastseen,
SubQuery2.Username,
SubQuery2.Userdomain,
tblCPlogoninfo.logontime
From tblAssets
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join (Select Top 1000000 SubQuery1.Username,
SubQuery1.Userdomain,
SubQuery1.Day,
Count(SubQuery1.Computer) As Count
From (Select Distinct Top 1000000 tblCPlogoninfo.Username,
tblCPlogoninfo.Domain As Userdomain,
Convert(nvarchar,tblCPlogoninfo.logontime,101) As Day,
tblCPlogoninfo.AssetID As Computer
From tblCPlogoninfo) SubQuery1
Group By SubQuery1.Username,
SubQuery1.Userdomain,
SubQuery1.Day) SubQuery2 On SubQuery2.Username = tblCPlogoninfo.Username And
SubQuery2.Userdomain = tblCPlogoninfo.Domain And SubQuery2.Day =
Convert(nvarchar,tblCPlogoninfo.logontime,101)
Where SubQuery2.Count > 1
Order By SubQuery2.Userdomain,
SubQuery2.Username,
SubQuery2.Day Desc,
tblAssets.Domain,
tblAssets.AssetName,
tblCPlogoninfo.logontime Desc
‎09-02-2014 01:26 AM
‎09-01-2014 04:57 PM
Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.IPAddress,
tblAssets.Firstseen,
tblAssets.Lastseen,
SubQuery2.Username,
SubQuery2.Userdomain,
tblCPlogoninfo.logontime
From tblAssets
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join (Select Top 1000000 SubQuery1.Username,
SubQuery1.Userdomain,
SubQuery1.Day,
Count(SubQuery1.Computer) As Count
From (Select Distinct Top 1000000 tblCPlogoninfo.Username,
tblCPlogoninfo.Domain As Userdomain,
Convert(nvarchar,tblCPlogoninfo.logontime,101) As Day,
tblCPlogoninfo.AssetID As Computer
From tblCPlogoninfo) SubQuery1
Group By SubQuery1.Username,
SubQuery1.Userdomain,
SubQuery1.Day) SubQuery2 On SubQuery2.Username = tblCPlogoninfo.Username And
SubQuery2.Userdomain = tblCPlogoninfo.Domain And SubQuery2.Day =
Convert(nvarchar,tblCPlogoninfo.logontime,101)
Where SubQuery2.Count > 1
Order By SubQuery2.Userdomain,
SubQuery2.Username,
SubQuery2.Day Desc,
tblAssets.Domain,
tblAssets.AssetName,
tblCPlogoninfo.logontime Desc
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now