Hi,
I have a quick question regarding the last login / username field from dbo.tblAssets.UserName
As we are a Multiple Domain environment the username refernce could be the same in 3 domains which means I get duplicate results when creating a new view;
Create VIEW dbo.AssetReport as
Select TOP 100 PERCENT dbo.tblAssets.AssetName
,dbo.tblAssetCustom.Serialnumber As "SerialNumber"
,dbo.tblAssetCustom.Manufacturer as "Vendor"
,dbo.tblAssetCustom.Model
,dbo.tblOperatingSystem.Caption as "OperatingSystem"
,dbo.tblOperatingSystem.ServicePackMajorVersion as "OperatingSystemServicePack"
,dbo.tblAssets.Userdomain
,dbo.tblAssets.Username
,dbo.tblADusers.Firstname
,dbo.tblADusers.Lastname
,dbo.tblADusers.email
,dbo.tblADusers.Department
,dbo.tblADComputers.Location as "WKS_AD_Location"
,dbo.tblADusers.Office
,dbo.tblAssets.IPAddress As "IPAddress"
,dbo.tblADComputers.OU AS "ComputerOU"
,dbo.tblADUsers.OU as "UserOU"
,dbo.tblAssets.Lastseen
,dbo.tblAssets.LastActiveScan
,dbo.tblADComputers.LastChanged
From dbo.tblAssets
Inner Join dbo.tblADComputers on dbo.tblAssets.AssetID = dbo.tblADComputers.AssetID
Inner Join dbo.tblAssetCustom On dbo.tblAssets.AssetID = dbo.tblAssetCustom.AssetID
Inner Join dbo.tblOperatingSystem On dbo.tblAssets.AssetID = dbo.tblOperatingSystem.AssetID
Left Join dbo.tblADUsers On dbo.tblAssets.Username = dbo.tblADUsers.Username
Order By dbo.tblAssets.AssetName
I need to create a view to select all data into excel for lookup on another AssetRegister, but on some systems I am geeting duplicates which then inturn invalidates the data. Can anyone think of a way to allow for these exceptions within the view or to allow for the "Last" login for a user on the host?
Or is there a table that records the Last user who logged into a pc and keeps only the last value?