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))>1
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?