Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Re: not single- group group function

Re: not single- group group function

From: Ed prochak <ed.prochak_at_magicinterface.com>
Date: 27 Apr 2004 10:47:58 -0700
Message-ID: <4b5394b2.0404270947.26608c4e@posting.google.com>


emtun_at_yahoo.com (moon) wrote in message news:<f4ff74b8.0404251918.4e1c0146_at_posting.google.com>...
> Hi all,
> Im trying to execute this statement in SQL Plus but am getting the
> error not a single-group group function. My code is below. To explain
> what Im trying to get at, I want to return the total grade for g.grade
> that has been multiplied by its appropriate weight that it carries
> towards the total grade.
>
>
> SELECT g.section_id, g.student_id, g.grade_type_code,
> SUM((AVG(g.grade)*30/100+AVG(g.grade)
> *20/100+AVG(g.grade)*20/100+AVG(g.grade)*10/100+AVG(g.grade)*20/100))
> FROM grade g, grade_type_weight gtw
> WHERE g.student_id = 270
> AND g.section_id = gtw.section_id
> AND g.grade_type_code = gtw.grade_type_code
> GROUP BY g.section_id, g.student_id,
> g.grade_type_code
> Any help is greatly appreciated:>
> Moon

The error is due to the nesting of the functions, I believe. IOW,

    SUM((AVG(... is not allowed.
Try creating an inline view.

Why the extra set of parentheses?

AND, WHY are you computing it this way?

  SUM((AVG(g.grade)*30/100
      +AVG(g.grade)*20/100
      +AVG(g.grade)*20/100
      +AVG(g.grade)*10/100
      +AVG(g.grade)*20/100))

Isn't that the same as SUM(AVG(g.grade)) ???? (I don't think my math is that rusty, or is it??)

  Ed Received on Tue Apr 27 2004 - 12:47:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US