Good resource for SQLAlso make sure you are using your database schema. You can open it from the report builder. Labeled "View Database Documentation" should be right of the title text box.
Select Top 1000000
tblSoftwareUni.softwareName As software,
tblSoftware.softwareVersion As version,
Count(tblAssets.AssetID) As Total
From tblAssets
Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Where
--use the DATEADD(measuring by, length, from when)
tblAssets.Lastseen > DATEADD(DAY, -30, GETDATE())
--use this to check if an asset is marked active 1=active
And tblAssetCustom.State = 1
And tblSoftwareUni.softwareName Like '%java%'
Group By tblSoftwareUni.softwareName,
tblSoftware.softwareVersion
--the having clause is only necessary if you are filtering on your agregate functions
--so if you wanted something like:
--HAVING Count(tblAssets.AssetID) > 10
--^ would only show software/versions that appear more than 10 times in your ecosystem
Order By Total Desc,
software