Solved

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

Posted on 2011-09-09
3
284 Views
Last Modified: 2012-05-12
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
Comment
Question by:pgroth
3 Comments
 
LVL 6

Accepted Solution

by:
mjfagan earned 125 total points
ID: 36512739
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
 
LVL 42

Expert Comment

by:dqmq
ID: 36512758
select MachineID from yourtable  t1
  where not exists
        (select * from yourtable t2
            where  t2.programname name = 'someprogrem.exe'
                and t2.machineID = t1.machineid)
0
 

Author Closing Comment

by:pgroth
ID: 36512781
Thanks - I believe the Exists command should work... not exists specifically.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question