Solved

oracle: not a single-group group function

Posted on 2013-02-04
3
644 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 74

Accepted Solution

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

763 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now