Home » SQL & PL/SQL » SQL & PL/SQL » group by , having question
group by , having question [message #18997] Mon, 25 February 2002 06:05 Go to next message
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
Re: group by , having question [message #18998 is a reply to message #18997] Mon, 25 February 2002 06:34 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
in "sum(f.TXN_PRINC_A ) >= ff.txn_amt" as txn_amt is not in group by clause u can not use that in the expression
Previous Topic: Changing the Visual Attributes using mouseover/mouse off
Next Topic: Which one is preferable ?
Goto Forum:
  


Current Time: Thu Mar 28 17:16:49 CDT 2024