Re: not single- group group function
Date: 27 Apr 2004 13:55:35 -0700
Message-ID: <2fee53a9.0404271255.da9a31b_at_posting.google.com>
Hi,
Try this
SElECT a.section_id , a.student_id , a.grade_type_code , SUM(a.averagecol) FROM ( SELECT g.section_id, g.student_id, g.grade_type_code,
(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) avaragecol 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 ) a
Group by a.section_id , a.student_id , a.grade_type_code
emgee74_at_yahoo.co.uk (SoulSurvivor) wrote in message news:<1ccd66a6.0404270127.1006b716_at_posting.google.com>...
> You will have to group by g.grade_type_code as well
>
> > GROUP BY g.section_id, g.student_id, g.grade_type_code
>
> M
>
> emtun_at_yahoo.com (moon) wrote in message news:<f4ff74b8.0404251918.4e1c0146@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
Received on Tue Apr 27 2004 - 22:55:35 CEST