Re: SQL Question re group averaging

From: JRStern <JRStern_at_gte.net>
Date: Sat, 21 Jul 2001 23:30:55 GMT
Message-ID: <3b279f0e.13533980_at_news.gte.net>


select count(myfield), AVG(myfield) from mytable where prodid='prodid'

J.

On 12 Jun 2001 10:24:01 -0700, jdriller_at_orchid.org (Jonathan Driller) wrote:
>I finally realized that I need to set an alias to use aggregate
>functions but still can't get what I need:
>I have a table of rankings for lots of products. I want to be able to
>say 'this
>product had 20 people rank it and the average rank is 7".
>If I say select sum(srating) then I sum every product together so I
>figure I need some where clause, but I can't figure out how to do
>this.
>
>I am using Cold Fusion so I can pass in a dynamic value If I wanted to
>get this for one item - but I want to output a list of ALL items and
>their values separately...
>'where prodid = #prodid#'
>
>Any help much appreciated.

Received on Sun Jul 22 2001 - 01:30:55 CEST

Original text of this message