group by , having question [message #18997] |
Mon, 25 February 2002 06:05 |
LI810
Messages: 25 Registered: February 2002
|
Junior Member |
|
|
Please help.
What is wrong with the statement.
I got error message ORA-00979
"not a group by expression" for the last line
"having sum(f.TXN_PRINC_A ) >= ff.txn_amt".
if I put the exact amount like
"having sum(f.TXN_PRINC_A ) >= 50000" it is working.
select f.BRN_I ,
f.ACC_I,
f.TXN_PSTG_D,
f.TXN_PRINC_A
from fedfund_trans_fact f,
(
select BRN_I ,ACC_I, TXN_PSTG_D,
TXN_PRINC_A* 0.5 txn_amt
from fedfund_trans_fact
where TXN_IN_OUT_C ='I'
group by BRN_I,ACC_I,TXN_PSTG_D,TXN_PRINC_A
having sum(TXN_PRINC_A ) >= 200000) ff
where
ff.brn_i=f.brn_i
and ff.acc_i=f.acc_i
and f.TXN_IN_OUT_C ='O'
and f.BNFY_3RD_PTY_C='Y'
and (f.TXN_PSTG_D >=ff.TXN_PSTG_D-30
or f.TXN_PSTG_D <=ff.TXN_PSTG_D+30)
group by f.BRN_I,
f.ACC_I,
f.TXN_PSTG_D,
f.TXN_PRINC_A
having sum(f.TXN_PRINC_A ) >= ff.txn_amt
|
|
|
|