Gossamer Forum
Home : General : Databases and SQL :

ORA-00979 not a GROUP by expression

Quote Reply
ORA-00979 not a GROUP by expression
Hi,
I got ORA-00979 not a GROUP by expression error while i am running the following SQL Statement in Report Builder's Data Block Group. I need to use both aggregate functions and indivisual columns but ineed not to add indivisual columns in GROUP by Expression. Pls any one send me the soloution.

select
max(bal.period_name) PERIOD_NAME,
sum(nvl(bal.begin_balance_dr,0)) BEGIN_DR,
sum(nvl(bal.begin_balance_cr,0)) BEGIN_CR,
sum(nvl(bal.begin_balance_dr,0) + nvl(bal.period_net_dr,0)) END_DR,
sum(nvl(bal.begin_balance_cr,0) + nvl(bal.period_net_cr,0)) END_CR,
nvl(bal.begin_balnce_dr,0) b_bal_dr,
nvl(bal.begin_balnce_cr,0) b_bal_cr,
nvl(bal.period_net_dr,0) p_net_dr,
nvl(bal.period_net_cr,0) p_net_cr
FROM gl_period_statuses per,
gl_code_combinations cc,
gl_balances bal
WHERE &WHERE_FLEX
AND cc.chart_of_accounts_id = :STRUCT_NUM
AND per.application_id = 101
AND per.set_of_books_id = :P_SET_OF_BOOKS_ID
AND per.effective_period_num
BETWEEN :START_EFFECTIVE_PERIOD_NUM
AND :END_EFFECTIVE_PERIOD_NUM
AND bal.code_combination_id = cc.code_combination_id
AND bal.period_name = per.period_name
AND bal.actual_flag = :P_ACTUAL_FLAG
AND &WHERE_ACTUAL_TYPE
AND &WHERE_CURRENCY_BAL
AND bal.set_of_books_id = :P_SET_OF_BOOKS_ID
AND bal.template_id is null
&SECURITY_FILTER_STR
GROUP BY per.period_year, per.period_num
ORDER BY per.period_year, per.period_num

Thanks
Sateesh