
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2016 10:13 PM
We track our software usage & purchases by Department. I have added a Department code to Software Purchase information in the Comments field. I am able to create a report to show me the count of purchases by Departments
I am also able to create a report to show me Software in Use by Department (based on OU groups)
How do I combine these two reports to show me Department, SoftwareName, In Use, Purchased -- all grouped by Department??
Select Cast(tblSublicensesOrders.Comments As NVARCHAR(100)) DEPT,
tblLicenses.softwareName,
Sum(tblSublicensesOrders.Nrlicenses) As PurchasedLicenses
From tblSublicensesOrders
Inner Join tblLicenses On tblLicenses.LicenseidID =
tblSublicensesOrders.LicenseidID
Group By Cast(tblSublicensesOrders.Comments As NVARCHAR(100)),
tblLicenses.softwareName
I am also able to create a report to show me Software in Use by Department (based on OU groups)
Select Top 1000000 tblADusers.Department,
tblLicenses.softwareName,
count(*) As InUseCount
From tblLicenses
Left Join tblSoftwareUni On tblSoftwareUni.softwareName =
tblLicenses.softwareName
Inner Join tblSoftware On tblSoftwareUni.SoftID = tblSoftware.softID
Inner Join tblAssets On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join tblADusers On tblAssets.Username = tblADusers.Username
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Where (tblAssetCustom.State = 1 Or tblAssetCustom.State = 2) And
(tblADComputers.OU Like '%Rockwall%' Or tblADComputers.OU Like '%Shared%' Or
tblADComputers.OU Like '%EMS%') And tblADusers.Userdomain = 'Greenville'
Group By tblADusers.Department,
tblLicenses.softwareName
How do I combine these two reports to show me Department, SoftwareName, In Use, Purchased -- all grouped by Department??
Solved! Go to Solution.
Labels:
- Labels:
-
Report Center
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 04:25 PM
Hi,
We received and answered this question via email. For everyone else's benefit, I'm pasting the SQL statement we sent via email below.
We received and answered this question via email. For everyone else's benefit, I'm pasting the SQL statement we sent via email below.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Memory,
tblAssets.Processor,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAntivirus.DisplayName As AntiVirus,
tblAntivirus.productUpToDate,
tblOperatingsystem.Caption As OperatingSystem,
tblOperatingsystem.Organization,
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]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tblAntivirus On tblAssets.AssetID = tblAntivirus.AssetID
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Where tblAssets.Domain Like '%lekpas%' And tblAssetCustom.State = 1 And
tblDiskdrives.DriveType = 3
Group By tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10,
tblAssets.IPAddress,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Memory,
tblAssets.Processor,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAntivirus.DisplayName,
tblAntivirus.productUpToDate,
tblOperatingsystem.Caption,
tblOperatingsystem.Organization
Order By tblAssets.Domain,
tblAssets.AssetName
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 04:25 PM
Hi,
We received and answered this question via email. For everyone else's benefit, I'm pasting the SQL statement we sent via email below.
We received and answered this question via email. For everyone else's benefit, I'm pasting the SQL statement we sent via email below.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Memory,
tblAssets.Processor,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAntivirus.DisplayName As AntiVirus,
tblAntivirus.productUpToDate,
tblOperatingsystem.Caption As OperatingSystem,
tblOperatingsystem.Organization,
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]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tblAntivirus On tblAssets.AssetID = tblAntivirus.AssetID
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Where tblAssets.Domain Like '%lekpas%' And tblAssetCustom.State = 1 And
tblDiskdrives.DriveType = 3
Group By tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10,
tblAssets.IPAddress,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Memory,
tblAssets.Processor,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAntivirus.DisplayName,
tblAntivirus.productUpToDate,
tblOperatingsystem.Caption,
tblOperatingsystem.Organization
Order By tblAssets.Domain,
tblAssets.AssetName

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 02:20 PM
Hello,
can you help me to combine two reports:
First:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Lastseen As [last scan],
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]
From tblAssets
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Group By tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Lastseen
Order By tblAssets.AssetID
Second:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Memory,
tblAssets.Processor,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAntivirus.DisplayName,
tblAntivirus.productUpToDate,
tblOperatingsystem.Caption,
tblOperatingsystem.Organization
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblAntivirus On tblAssets.AssetID = tblAntivirus.AssetID
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Where tblAssets.Domain Like '%lekpas%' And tblAssetCustom.State = 1
can you help me to combine two reports:
First:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Lastseen As [last scan],
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]
From tblAssets
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Group By tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Lastseen
Order By tblAssets.AssetID
Second:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Memory,
tblAssets.Processor,
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAntivirus.DisplayName,
tblAntivirus.productUpToDate,
tblOperatingsystem.Caption,
tblOperatingsystem.Organization
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblAntivirus On tblAssets.AssetID = tblAntivirus.AssetID
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Where tblAssets.Domain Like '%lekpas%' And tblAssetCustom.State = 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2016 05:00 PM
You can try turning your queries into sub queries and linking them that way, like so:
Select Top 1000000 SubQuery1.Department,
SubQuery1.softwareName,
SubQuery1.InUseCount,
SubQuery2.PurchasedLicenses
From (Select Top 1000000 tblADusers.Department,
tblLicenses.softwareName,
count(*) As InUseCount
From tblLicenses
Left Join tblSoftwareUni On tblSoftwareUni.softwareName =
tblLicenses.softwareName
Inner Join tblSoftware On tblSoftwareUni.SoftID = tblSoftware.softID
Inner Join tblAssets On tblAssets.AssetID = tblSoftware.AssetID
Left Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Left Join tblADusers On tblAssets.Username = tblADusers.Username And
tblADusers.Userdomain = tblAssets.Userdomain
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Where (tblAssetCustom.State = 1 Or tblAssetCustom.State = 2) And
(tblADComputers.OU Like '%rockwall%' Or tblADComputers.OU Like '%shared%' Or
tblADComputers.OU Like '%ems%') And tblADusers.Userdomain = 'greenville'
Group By tblADusers.Department,
tblLicenses.softwareName) SubQuery1
Left Join (Select Cast(tblSublicensesOrders.Comments As NVARCHAR(100)) DEPT,
tblLicenses.softwareName,
Sum(tblSublicensesOrders.Nrlicenses) As PurchasedLicenses
From tblSublicensesOrders
Inner Join tblLicenses On tblLicenses.LicenseidID =
tblSublicensesOrders.LicenseidID
Group By Cast(tblSublicensesOrders.Comments As NVARCHAR(100)),
tblLicenses.softwareName) SubQuery2 On SubQuery2.DEPT = SubQuery1.Department
And SubQuery2.softwareName = SubQuery1.softwareName
