473,767 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

not single- group group function

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_co de,
SUM((AVG(g.grad e)*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_weig ht gtw
WHERE g.student_id = 270
AND g.section_id = gtw.section_id
AND g.grade_type_co de = gtw.grade_type_ code
GROUP BY g.section_id, g.student_id,
g.grade_type_co de
Any help is greatly appreciated:>
Moon
Jul 19 '05 #1
3 15767
You will have to group by g.grade_type_co de as well
GROUP BY g.section_id, g.student_id, g.grade_type_co de
M

em***@yahoo.com (moon) wrote in message news:<f4******* *************** ****@posting.go ogle.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_co de,
SUM((AVG(g.grad e)*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_weig ht gtw
WHERE g.student_id = 270
AND g.section_id = gtw.section_id
AND g.grade_type_co de = gtw.grade_type_ code
GROUP BY g.section_id, g.student_id,
g.grade_type_co de
Any help is greatly appreciated:>
Moon

Jul 19 '05 #2
em***@yahoo.com (moon) wrote in message news:<f4******* *************** ****@posting.go ogle.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_co de,
SUM((AVG(g.grad e)*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_weig ht gtw
WHERE g.student_id = 270
AND g.section_id = gtw.section_id
AND g.grade_type_co de = gtw.grade_type_ code
GROUP BY g.section_id, g.student_id,
g.grade_type_co de
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.grad e)*30/100
+AVG(g.grade)*2 0/100
+AVG(g.grade)*2 0/100
+AVG(g.grade)*1 0/100
+AVG(g.grade)*2 0/100))

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

Ed
Jul 19 '05 #3
Hi,

Try this

SElECT a.section_id , a.student_id , a.grade_type_co de , SUM(a.averageco l) FROM
( SELECT g.section_id, g.student_id, g.grade_type_co de,
(AVG(g.grade)*3 0/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_weig ht gtw
WHERE g.student_id = 270
AND g.section_id = gtw.section_id
AND g.grade_type_co de = gtw.grade_type_ code
GROUP BY g.section_id, g.student_id,
g.grade_type_co de ) a
Group by a.section_id , a.student_id , a.grade_type_co de

em*****@yahoo.c o.uk (SoulSurvivor) wrote in message news:<1c******* *************** ****@posting.go ogle.com>...
You will have to group by g.grade_type_co de as well
GROUP BY g.section_id, g.student_id, g.grade_type_co de


M

em***@yahoo.com (moon) wrote in message news:<f4******* *************** ****@posting.go ogle.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_co de,
SUM((AVG(g.grad e)*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_weig ht gtw
WHERE g.student_id = 270
AND g.section_id = gtw.section_id
AND g.grade_type_co de = gtw.grade_type_ code
GROUP BY g.section_id, g.student_id,
g.grade_type_co de
Any help is greatly appreciated:>
Moon

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8262
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to understand.)
4
2782
by: Venkat | last post by:
Hi All, I need to copy strings from a single dimensional array to a double dimensional array. Here is my program. #include <stdio.h> #include <stdlib.h>
2
9763
by: John Dann | last post by:
I'm retrieving some columns from a database with numeric values that fall comfortably within the range of the Single type and I'm tempted to use Single for the relevant column type in the retrieved dataset. (Actually the values are held as integers in the database for compact storage but are scaled to their true Single values during retrieval). But I'm sure that I keep reading that there's no performance penalty to using Double rather...
9
5111
by: MrSpock | last post by:
1. Create a new Windows Application project. 2. Open the project properties and check "Make single instance application". 3. Build. 4. Go to the release folder and run the application. 5. Try to open a second instance of the application. This will cause an unhandled exception and the "Send Error Report" box shows up. Does this happen to anyone else, or is it just me? Debug info: "Unhandled exception at 0x00e149fd in...
13
4281
by: Kevin Walzer | last post by:
Which of the Windows/Unix package builders for Python applications is capable of creating single-file executables? I'm thinking of: 1. py2exe 2. Mcmillan Installer/PyInstaller 3. cxfreeze The apps I've seen created by py2exe aren't single-file at all, the install folder is full of files besides the main program. I'm looking for a solution that stuffs all libraries, scripts, and the Python
11
2257
by: Pieter | last post by:
Hi, I'm having some troubles with my numeric-types in my VB.NET 2005 application, together with a SQL Server 2000. - I first used Single in my application, and Decimal in my database. But a Single with value 4.475 was converted to a Decimal with value 4.4749999999999996D. So after inserting and selecting it from the database I got another value than the original!
7
12240
by: ashley.ward | last post by:
We have been using VB6 to develop small custom apps that access an Oracle database, in order to extend a larger product that is developed by our colleagues in Germany (who use C++ and Java). As each app is small and simple, we have been distributing each to the customer in the form of a single EXE file. I have been attempting to build another one of these small custom apps, using VB 2005 Express Edition. It doesn't seem to be possible...
11
1870
by: Elmo | last post by:
Hi all! I am not very proud to ask this but here is my problem: string code = "\'13\'" The string code will have to contain following info: '51','52','63','other'... to get certain info from the database. When the querry is parsed these values will be looked up:
3
2743
by: Eric Layman | last post by:
Hi, I've saved data into the db by doing a replace() on single quote. Right now on data display on a datagrid, it shows double single quote. How do I make changes during run time of datagrid so that the double single quote will be replaced as single quote? Pls advise.
3
1720
by: sklett | last post by:
I suspect the answer might be in one of the words of my subject, but here goes anyway. I'm working on a system that will execute a very long (300+) chain of task objects. Here is some quick pseudo code to illustrate: public class VideoAcquisition { public Image GetFrame(){}; // other stuff
0
9571
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9405
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10013
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8838
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7383
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5424
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.