Here's what I've come up with:
select distinct [800number], (
select top 1 CompanyName
from calldata
where calldata.[800number]=cd.[800number]
group by [800number], CompanyName
order by [800number], count(*) desc) as companyname
from calldata cd
My issue is this solution doesn't list companyname that have matching row counts. Meaning is 8001231234 "newcars" as 3 rows and 8001231234 "cars" has 3 rows only one of those will be listed. I wanted both of them listed because they have the same 800 number - 8001231234. Any ideas how to rewrite the query to accomplish this requirement?