?
Solved

oracle: not a single-group group function

Posted on 2013-02-04
3
Medium Priority
?
682 Views
Last Modified: 2013-02-06
hi guys

I do

select id, to_char(SUM(salary),'999,999,999,999') as salary from customer .

customer table has
id salary


I get error
ORA-00937: not a single-group group function
00937. 00000 -  "not a single-group group function"
*Cause:    
*Action:

any idea? Am i missing GROUP BY clause ? not sure if i need one.

thanks
0
Comment
Question by:royjayd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1100 total points
ID: 38851967
Because you are selecting two columns--where one is an aggregate column, yes, you need a GROUP BY. GROUP BY the id column.
0
 
LVL 20

Assisted Solution

by:flow01
flow01 earned 100 total points
ID: 38851974
No , you can create a total  on the whole set of records without a group by clause, but
you will have to omit the  "id" because that's the value of a single record.

If you want the total salary by id ,your have to add a corresponding group by clause
0
 
LVL 15

Assisted Solution

by:Aaron Shilo
Aaron Shilo earned 100 total points
ID: 38858578
select id, to_char(SUM(salary),'999,999,999,999') as salary
from customer
group by ID;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to recover a database from a user managed backup
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question