cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AM13337
Engaged Sweeper III
I know this has been asked before but if somebody is able to help me with this report i would really appreciate it.

The report is useful for me, but I'd like to add some joins to make these two fields clickable. Also, if you see any ways to improve the way the code is written please let me know.

tblADusers.Displayname As Username,
tblADusers.Department As [User Department],

This is my report:

Select Distinct Top 1000000 tblAssets.AssetID,
tblAssetCustom.BarCode As [Asset ID #],
tblAssets.AssetName,
tsysIPLocations.IPLocation,
tblADusers.Displayname As Username,
tblADusers.Department As [User Department],
tblAssetCustom.Department As [Department Owner],
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Custom1 As [Purchase Price],
tblAssets.Memory,
tblAssets.Processor,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblOperatingsystem.Caption As OS,
(Select M1.MonitorModel From (Select tblMonitor.MonitorModel,
Row_Number() Over (Order By tblMonitor.MonitorID) As Rownumber
From tblMonitor
Where tblMonitor.AssetID = tblAssets.AssetID) M1
Where M1.Rownumber = 1) As [Monitor 1],
(Select M2.MonitorModel From (Select tblMonitor.MonitorModel,
Row_Number() Over (Order By tblMonitor.MonitorID) As Rownumber
From tblMonitor
Where tblMonitor.AssetID = tblAssets.AssetID) M2
Where M2.Rownumber = 2) As [Monitor 2],
tsysOS.Image As icon
From tblAssets
Left Outer Join tsysIPLocations On tblAssets.IPNumeric >=
tsysIPLocations.StartIP And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Inner Join tblAssetCustom On tblAssetCustom.AssetID = tblAssets.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Left Outer Join tblOperatingsystem On tblOperatingsystem.AssetID =
tblAssets.AssetID
Left Outer Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tblADusers On tblADusers.Username = tblAssets.Username And
tblADusers.Userdomain = tblAssets.Userdomain
Where tblComputersystem.Domainrole < 2
Order By tblAssets.AssetName
0 REPLIES 0

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now