View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default SQL - As part of an aggregate function ERROR

Try:

Sql="select distinct(fchar),sum(Freq) from ( "
Sql = Sql & "select mid(f1,1,1) as fchar, 1 as Freq from [" & strRange1 &
"] ) a group by fchar



"dave k" wrote:

I am trying to extract the first digit of a list of numbers and related count
of those numbers. In the following SQL statement I get the error "You are
trying to use mid(F1,1,1) as part of an aggregate function error. I am not
sure what that means and can't find it in the help files.

SELECT mid(F1,1,1), COUNT(mid(F1,1,1)) FROM [" & strRange1 & "]

Any ideas? I have tried using "Group by" witht the same error. Anytime
Count is included in any form I seem to get that error.

Thanks,
Dave