‎08-27-2018 04:12 AM
Solved! Go to Solution.
‎08-27-2018 03:53 PM
Select Distinct Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADusers.Displayname,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate As [Purchase Date],
tblAssetCustom.Warrantydate As [Warranty Expiration],
tblAssets.Processor,
tblAssets.Memory,
Sum(Cast(Cast(tblDiskdrives.Size As BigInt) / 1024 / 1024 / 1024 As Numeric))
As [Total size (GB)],
Sum(Cast(Cast(tblDiskdrives.Freespace As BigInt) / 1024 / 1024 /
1024 As Numeric)) As [Free in GB],
tblAssets.IPAddress,
tsysOS.Image As icon,
tblAssets.Lastseen,
SubQuery1.[Windows Graphics Card 2],
SubQuery1.[Windows Graphics Card]
From tblAssets
Left Join (Select Top 1000000 tblAssets.AssetID, ) As SubQuery1 On SubQuery1.AssetID =
tblAssets.AssetName,
Max(tblVideoController.Caption) As [Windows Graphics Card],
Min(tblVideoController.Caption) As [Windows Graphics Card 2]
From tblVideoController
Inner Join tblAssets On tblAssets.AssetID = tblVideoController.AssetID
Group By tblAssets.AssetID,
tblAssets.AssetName
tblAssets.AssetID
Inner Join tblAssetCustom On tblAssetCustom.AssetID = tblAssets.AssetID
Left Join tblADusers On tblADusers.Userdomain = tblAssets.Userdomain
And tblADusers.Username = tblAssets.Username
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Where tblAssetCustom.State = 1
Group By tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADusers.Displayname,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssets.Processor,
tblAssets.Memory,
tblAssets.IPAddress,
tsysOS.Image,
tblAssets.Lastseen,
SubQuery1.[Windows Graphics Card 2],
SubQuery1.[Windows Graphics Card]
‎08-27-2018 03:53 PM
Select Distinct Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADusers.Displayname,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate As [Purchase Date],
tblAssetCustom.Warrantydate As [Warranty Expiration],
tblAssets.Processor,
tblAssets.Memory,
Sum(Cast(Cast(tblDiskdrives.Size As BigInt) / 1024 / 1024 / 1024 As Numeric))
As [Total size (GB)],
Sum(Cast(Cast(tblDiskdrives.Freespace As BigInt) / 1024 / 1024 /
1024 As Numeric)) As [Free in GB],
tblAssets.IPAddress,
tsysOS.Image As icon,
tblAssets.Lastseen,
SubQuery1.[Windows Graphics Card 2],
SubQuery1.[Windows Graphics Card]
From tblAssets
Left Join (Select Top 1000000 tblAssets.AssetID, ) As SubQuery1 On SubQuery1.AssetID =
tblAssets.AssetName,
Max(tblVideoController.Caption) As [Windows Graphics Card],
Min(tblVideoController.Caption) As [Windows Graphics Card 2]
From tblVideoController
Inner Join tblAssets On tblAssets.AssetID = tblVideoController.AssetID
Group By tblAssets.AssetID,
tblAssets.AssetName
tblAssets.AssetID
Inner Join tblAssetCustom On tblAssetCustom.AssetID = tblAssets.AssetID
Left Join tblADusers On tblADusers.Userdomain = tblAssets.Userdomain
And tblADusers.Username = tblAssets.Username
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Where tblAssetCustom.State = 1
Group By tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADusers.Displayname,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssets.Processor,
tblAssets.Memory,
tblAssets.IPAddress,
tsysOS.Image,
tblAssets.Lastseen,
SubQuery1.[Windows Graphics Card 2],
SubQuery1.[Windows Graphics Card]
‎08-28-2018 03:19 AM
Charles.X wrote:
If you have assets with 2 GPUs, it is normal for the report to give multiple lines per asset since both GPUs are requested.
The way you can get around it is to create a subquery which shows the second graphics card. However, to do it clean it's not as simple. The query below does show both GPU's in one line, but if an asset only has 1 GPU it will show that one twice.
I've looked for a while, but wasn't able to really figure out how to create a condition which allows you to only show 1 GPU if the asset only has 1.
I've highlighted the subquery used.Select Distinct Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADusers.Displayname,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate As [Purchase Date],
tblAssetCustom.Warrantydate As [Warranty Expiration],
tblAssets.Processor,
tblAssets.Memory,
Sum(Cast(Cast(tblDiskdrives.Size As BigInt) / 1024 / 1024 / 1024 As Numeric))
As [Total size (GB)],
Sum(Cast(Cast(tblDiskdrives.Freespace As BigInt) / 1024 / 1024 /
1024 As Numeric)) As [Free in GB],
tblAssets.IPAddress,
tsysOS.Image As icon,
tblAssets.Lastseen,
SubQuery1.[Windows Graphics Card 2],
SubQuery1.[Windows Graphics Card]
From tblAssets
Left Join (Select Top 1000000 tblAssets.AssetID, ) As SubQuery1 On SubQuery1.AssetID =
tblAssets.AssetName,
Max(tblVideoController.Caption) As [Windows Graphics Card],
Min(tblVideoController.Caption) As [Windows Graphics Card 2]
From tblVideoController
Inner Join tblAssets On tblAssets.AssetID = tblVideoController.AssetID
Group By tblAssets.AssetID,
tblAssets.AssetName
tblAssets.AssetID
Inner Join tblAssetCustom On tblAssetCustom.AssetID = tblAssets.AssetID
Left Join tblADusers On tblADusers.Userdomain = tblAssets.Userdomain
And tblADusers.Username = tblAssets.Username
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Where tblAssetCustom.State = 1
Group By tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADusers.Displayname,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssets.Processor,
tblAssets.Memory,
tblAssets.IPAddress,
tsysOS.Image,
tblAssets.Lastseen,
SubQuery1.[Windows Graphics Card 2],
SubQuery1.[Windows Graphics Card]
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now