title: sql - comparing substrings instead of entire string
body: <pre><code>select substring(datapath,1,5), COUNT(substring(datapath,1,5)) from batchinfo
  where datapath like '%thc%'
  group by datapath
  having COUNT(substring(datapath,1,5))&gt;1
  </code></pre>
  
  <p>i am trying to count how many of each substrings there are in the table and for some reason it counts the ENTIRE string. what am i doing wrong?</p>