Solved

How can I group and sumarize dollar amounts by sales office, sales rep, and client

Posted on 2013-01-22
3
605 Views
Last Modified: 2013-01-22
How can I group and sumarize dollar amounts by sales office, sales rep, and client  

I keep getting error with code below:

[1]: ORA-00937: not a single-group group function

Select extract(month from rslcd.rfp_requested_beg_dt) as rmonth, sum(rslf.rfp_est_annual_premium_amt)
from adm.rfp_sl_fact rslf
join adm.b_rfp_sl_coverage_dim rslcd on rslf.rfp_sl_coverage_key = rslcd.rfp_sl_coverage_key
where  extract(month from rslcd.rfp_requested_beg_dt) = 10
and extract(year from rslcd.rfp_requested_beg_dt) = 2011
0
Comment
Question by:conardb
3 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 38807235
You group by all non-aggregate columns.

From the SQL you posted, you SUM on rslf.rfp_est_annual_premium_amt, so you need to group by extract(month from rslcd.rfp_requested_beg_dt).

If you add additional columns for sales office, sales rep, and client , you will need to group by those as well.

If you can provide some sample data and expected results, and what reporting tool you are using we can probably provide a working model.
0
 
LVL 15

Assisted Solution

by:Devinder Singh Virdi
Devinder Singh Virdi earned 250 total points
ID: 38807237
Syntax:

select col1, col2, sum(col3) from table
Where Col3 <> condition_1
group by Col1, col2
having count(*) > condition_2

In your statement, group by statement is missing.
0
 

Author Closing Comment

by:conardb
ID: 38807364
Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

821 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