[thelist] SQL: COUNTing and SUMming and whatnot

Chris W. Parker cparker at swatgear.com
Thu Oct 17 15:24:01 CDT 2002

> -----Original Message-----
> From: rudy [mailto:r937 at interlog.com]
> try this
> SELECT 'occurrences by product: '
>      , PP.ppName
>      , COUNT(productTracking.id)
>          AS numberofoccurrences
>   FROM PossibleProducts PP
>   JOIN productTracking PT
>     ON PP.id = PT.ptProduct
> GROUP BY PP.ppName

didn't seem to work (most likely my fault though). i get an error that
says "Too few parameters. Expected 1." that usually suggests that
something is spelled wrong. i checked it and eveything is correct.

why do you do "AS numberofoccurrences" and then never use
"numberofoccurrences" again?

thanks for your help rudy.


More information about the thelist mailing list