Select Distinct Top 1000000 dbo.tblSoftware.softwareName As Software,
dbo.tblSoftware.softwareVersion As Version, dbo.tblSoftware.SoftwarePublisher,
Count(dbo.tblSoftware.ComputerName) As Count
From dbo.tblSoftware Inner Join
tblLicenses On tblLicenses.softwareName = dbo.tblSoftware.softwareName
Group By dbo.tblSoftware.softwareName, dbo.tblSoftware.softwareVersion,
dbo.tblSoftware.SoftwarePublisher
Having dbo.tblSoftware.SoftwarePublisher Like '%microsoft%' And
Count(dbo.tblSoftware.ComputerName) > 0
Order By dbo.tblSoftware.softwareName
You can start from here but most likely you need to add table tblsublicenses and link this table to table software.