cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
yallah
Engaged Sweeper II
Apologies if this has been asked before. I have an asset report to output workstation name, user, make, model etc

When it runs it gives me two rows for each workstation and I cannot for the life of me work out where the error is in the code. Can anyone assist?


Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblADusers.Displayname,
tblAssets.Description,
tblADusers.Office,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssets.Lastseen,
tblAssets.Domain,
tblOperatingsystem.Caption,
tblOperatingsystem.ServicePackMajorVersion,
tblAssets.Processor,
tblAssets.Memory,
tblComputersystem.Lastchanged,
tsysOS.Image As icon,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblOperatingsystem.InstallDate,
tblComputersystem.PartOfDomain
From tblComputersystem
Inner Join tblAssets On tblComputersystem.AssetID = tblAssets.AssetID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tblADusers On tblADusers.Username = tblAssets.Username
Where tblComputersystem.Domainrole < 2 And tblAssetCustom.State = 1
Order By tblAssets.AssetName
1 REPLY 1
Hemoco
Lansweeper Alumni
The link on username is not unique. You need to link userdomain too.

Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblADusers.Displayname,
tblAssets.Description,
tblADusers.Office,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssets.Lastseen,
tblAssets.Domain,
tblOperatingsystem.Caption,
tblOperatingsystem.ServicePackMajorVersion,
tblAssets.Processor,
tblAssets.Memory,
tblComputersystem.Lastchanged,
tsysOS.Image As icon,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblOperatingsystem.InstallDate,
tblComputersystem.PartOfDomain
From tblComputersystem
Inner Join tblAssets On tblComputersystem.AssetID = tblAssets.AssetID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tblADusers On tblADusers.Username = tblAssets.Username And
tblAssets.Userdomain = tblADusers.Userdomain
Where tblComputersystem.Domainrole < 2 And tblAssetCustom.State = 1
Order By tblAssets.AssetName