Solved

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

Posted on 2013-01-22
3
573 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 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
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 how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

762 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

9 Experts available now in Live!

Get 1:1 Help Now