title: Aggregate clause on varchar datatype in subquery
body: <p>I'd like to do the following with a sub query, even though I can do it another way.  I'm querying a large junction table and inside of that query I want to get a count of all the county names that come up more than X number of times.  </p>
  
  <pre><code>select v.id, k.countyName
  from v inner join k on v.countyID=k.countyID inner join
  icd_jxn on v.id = icd_jxn.id
  where k.countyName in
  (select count(k.countyName) from k
  having count(k.countyName) &gt; 10)
  </code></pre>
  
  <p>The error given is <code>conversion failed when converting the varchar value X to int</code>.  I don't want to do any conversion, I just want a number of the times the county name appears on the table.</p>
  
  <p><img src="https://i.stack.imgur.com/QGEM3.jpg" alt="enter image description here"></p>