‎01-11-2019 04:39 PM
Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tsysOS.OSname As OS,
tblAssets.OScode + '.' + tblAssets.BuildNumber As Build,
tblAssets.Version As [OS Version],
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
tblAssets.IPAddress,
tblAssets.Description,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Location,
tsysIPLocations.IPLocation,
tblAssets.Firstseen,
tblAssets.Lastseen
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tsysIPLocations On tblAssets.LocationID = tsysIPLocations.LocationID
Left Join (Select A.Version,
Row_Number() Over (Order By A.Version Desc) As RowNumber
From (Select Distinct A.Version
From tblAssets A
Inner Join tsysOS B On A.OScode = B.OScode
Inner Join (Select Top 1 A.Version,
Count(1) As Total
From tblAssets A
Inner Join tsysOS B On A.OScode = B.OScode
Where B.OSname = 'Win 10'
Group By A.Version
Order By Total Desc) C On 1 = 1
Where A.Version <= C.Version And B.OSname = 'Win 10') A) Versions On
tblAssets.Version = Versions.Version
Where tsysOS.OSname = 'Win 10' And tblAssetCustom.State = 1 And
(Versions.RowNumber >= 2 Or tblAssets.Version Is Null)
Order By tblAssets.Lastseen Desc
‎03-01-2019 07:16 PM
‎03-01-2019 09:59 PM
‎03-01-2019 05:51 PM
‎03-01-2019 06:17 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now