Solved

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

Posted on 2011-09-09
3
286 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How efficient to move databases to Azure? 5 55
How do I figure out how much database is expected to grow? 15 76
Star schema daily updates 2 35
How can I find this data? 3 25
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
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…

756 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