[thelist] SQL: using GROUP BY and COUNT

rudy r937 at interlog.com
Fri Aug 16 23:20:01 CDT 2002


>goggles
>goggles 2s
>goggle's
>
>... what would it take ... to be able to GROUP BY "goggle"
>  and other keywords so that anything including "goggle"
> would be GROUP'ed

quick question, chris -- obviously if you feed in a specific keyword like
"goggle" then you'd get only one group back, right?  so you aren't feeding
in the keywords, what you must want is just to group by the leftmost N
columns, where N is some number like 6?

if that's the case, then

SELECT Left(zrSearchString,6) as "keyword"
     , COUNT(*)
     , zrFromWhere
  FROM ZeroResults
 WHERE zrTimeAdded
       BETWEEN #1/1/02# AND #1/31/02#
GROUP BY Left(zrSearchString,6), zrFromWhere
ORDER BY COUNT(*) DESC
     , Left(zrSearchString,6)

rudy




More information about the thelist mailing list