title: SQL Query to Find Unique Values After Where and GroupBy
body: <p>Using AWS Athena to Query an aws_application table.</p>
  
  <p>Table has things such as following</p>
  
  <pre><code>ID | Name 
  server1  | Word 
  server1  | Excel
  server2  | Word 
  server2  | Excel
  server3  | Word 
  server3  | Excel
  server3  | Notepad 
  </code></pre>
  
  <p>I'm looking for SQL Query that can list the server ID's (in this example) that DON'T have "Notepad" installed. The result should show.</p>
  
  <pre><code>ID
  server1
  server2
  </code></pre>
  
  <p>I'm new to this and so far I can only show which server has notepad. I thought I could somehow join the table to itself and subtract to try and get the unique ID's.</p>
  
  <p>The above example is generic but easier to explain. In my exact I can run the following </p>
  
  <pre><code>select distinct resourceid
  from aws_application
  where name = 'Excel'
  or name = 'Word'
  group by resourceid
  </code></pre>
  
  <p>And get a total of 108 servers.</p>
  
  <p>If I run </p>
  
  <pre><code>select distinct resourceid
  from aws_application
  group by resourceid
  </code></pre>
  
  <p>I get a unique count of 116 total servers. I want to return the number 8. </p>
  
  <p>Of course there are thousands of lines in here as each line in the table represents a different application exe installed on the box.</p>