Avatar of maximus81
maximus81
Flag for United States of America asked on

Need help with advanced MySQL query

Im trying to create a query that will list all the computers a piece of software is installed on. The systems are in there own table called system and identified by a number called system_id. The software is in the table sys_sw_software and the ID tied to the system_id is called system_id.

I would like to search for the name of a piece of software which is called software_name and then get a list of all the systems that its installed on from system table.
MySQL Server

Avatar of undefined
Last Comment
maximus81

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
dsacker

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
maximus81

ASKER
Thanks. This is what i am using:

select  
system.hostname,
sys_sw_software.software_name,
sys_sw_software.software_publisher,
sys_sw_software.software_version
from system
inner join sys_sw_software on sys_sw_software.system_id = system.system_id
where sys_sw_software.timestamp = system.timestamp
AND sys_sw_software.software_name = 'Software Name'
dsacker

What does requiring the two timestamps equal accomplish. Just curious, as logically, I saw a simple join by system_id?
maximus81

ASKER
If you don't add the timestamps you get all the old data also. This ensures that you get the newest information from the database. Let say I deleted a piece of software off a machine and then I ran the audit script, without the timsetamps it would add that to the query.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes