Solved

oracle: not a single-group group function

Posted on 2013-02-04
3
659 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
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 275 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 25 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 25 total points
ID: 38858578
select id, to_char(SUM(salary),'999,999,999,999') as salary
from customer
group by ID;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
clob to char in oracle 3 62
Trying to get a Linked Server to Oracle DB working 21 69
update statement in oracle 9 29
join a table with user_tab_columns in oracle 3 50
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

828 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