Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 631
  • Last Modified:

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

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
conardb
Asked:
conardb
2 Solutions
 
slightwv (䄆 Netminder) Commented:
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
 
Devinder Singh VirdiCommented:
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
 
conardbAuthor Commented:
Thanks
0

Featured Post

Industry Leaders: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now