title: SQL Query Help: Returning distinct values from Count subquery
body: <p>I've been stuck for quite a while now trying to get this query to work.
  Here's the setup:</p>
  
  <p>I have a [Notes] table that contains a nonunique (Number) column and a nonunique (Result) column. I'm looking to create a SELECT statement that will display each distinct (Number) value where the count of the {(Number), (Result)} tuple where Result = 'NA' is > 25.</p>
  
  <pre><code>Number | Result  
   100   |  'NA'  
   100   |  'TT'  
   101   |  'NA'  
   102   |  'AM'  
   100   |  'TT'  
   200   |  'NA'  
   200   |  'NA'  
   201   |  'NA'
  </code></pre>
  
  <p>Basically, have an autodialer that calls a number and returns a code depending on the results of the call. We want to ignore numbers that have had an 'NA'(no answer) code returned more than 25 times.</p>
  
  <p>My basic attempts so far have been similar to:</p>
  
  <pre><code>SELECT DISTINCT n1.Number 
  FROM Notes n1 
  WHERE (SELECT COUNT(*) FROM Notes n2
         WHERE n1.Number = n2.Number and n1.Result = 'NA') &gt; 25
  </code></pre>
  
  <p>I know this query isn't correct, but in general I'm not sure how to relate the DISTINCT n1.Number from the initial select to the Number used in the subquery COUNT.  Most examples I see aren't actually doing this by adding a condition to the COUNT returned.  I haven't had to touch too much SQL in the past half decade, so I'm quite rusty.</p>