Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 293
  • Last Modified:

An SQL Query for a specific executable that is NOT on a machine

I am new to sql queries - I have no problem finding something that IS on a machine, but today I was asked to find machines that do NOT have a specific executable.

In this case, I am only looking for "someprogram.exe" to not be on a machine, and I don't want to see all the programs that are not like "someprogram.exe" because that will list everything on the machines.

How would I write a query to look for something to not be on the machine.

Just to keep it easy - lets say everything is in one table so we don't need to join anything - I just need to know some basic syntax.

Thanks
0
pgroth
Asked:
pgroth
1 Solution
 
Molly FaganApplications Team SupervisorCommented:
Check out the IN and EXISTS functions.  You can do NOT IN and NOT EXISTS.

http://www.techonthenet.com/sql/in.php
      
http://www.techonthenet.com/sql/exists.php
      
0
 
dqmqCommented:
select MachineID from yourtable  t1
  where not exists
        (select * from yourtable t2
            where  t2.programname name = 'someprogrem.exe'
                and t2.machineID = t1.machineid)
0
 
pgrothAuthor Commented:
Thanks - I believe the Exists command should work... not exists specifically.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now