Link to home
Start Free TrialLog in
Avatar of maximus81
maximus81Flag for United States of America

asked on

Want to get a count of software installed using a mysql query

Here is the query I have:

SELECT
sys_sw_software.software_name,
sys_sw_software.software_version
FROM
sys_sw_software, system
WHERE sys_sw_software.timestamp = system.timestamp
AND sys_sw_software.software_name LIKE '%Cisco% %Agent%'

This will list all the Cisco Agent software but I want to get a count of them for each version. We have three different versions installed and I want to get a count of each. I tried this query but it never gives me all the versions.

SELECT COUNT(DISTINCT system.system_id) AS
software_count,
sys_sw_software.software_name,
sys_sw_software.software_version,
sys_sw_software.software_publisher

FROM sys_sw_software, system

WHERE sys_sw_software.timestamp = system.timestamp
AND software_comment NOT LIKE 'Update'
AND software_comment NOT LIKE 'codec'
AND software_comment NOT LIKE 'odbc driver'
AND software_name NOT LIKE ''
AND software_name LIKE '%cisco%'
GROUP BY sys_sw_software.software_name
ORDER BY sys_sw_software.software_name
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

What error do you get? I would think that you have to group by sys_sw_software.software_version and sys_sw_software.software_publisher as well (besides only sys_sw_software.software_name that you have now.
ASKER CERTIFIED SOLUTION
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maximus81

ASKER

This gets me close to what i want

SELECT
sys_sw_software.software_name,
sys_sw_software.software_version
FROM
sys_sw_software, system
WHERE sys_sw_software.timestamp = system.timestamp
AND sys_sw_software.software_name LIKE '%Cisco% %Agent%'
GROUP BY sys_sw_software.software_version

This lists out:

Cisco Agent Desktop       71.0.22
Cisco Agent Desktop       85.1.214
Cisco Agent Desktop       85.1.312

I would like to get a count of each of them.
I figured this out. This is what I used.

SELECT COUNT(DISTINCT system.system_id) AS
software_count,
sys_sw_software.software_name,
sys_sw_software.software_version
FROM
sys_sw_software, system
WHERE sys_sw_software.timestamp = system.timestamp
AND sys_sw_software.software_name LIKE '%Microsoft Office Standard%'
GROUP BY sys_sw_software.software_version