Hi,
Recently I got a great help from SantaMufasa (thread 759-911843) with resolving totals calculations problem.I did got totals I needed! Now I realized I also need other fields (except err_num)to be dispayed. Since the nature of Group by does not allow it, I assumed I need a subquery for that purpose:
I tried the following one:
select r.run_date,e.err_descr,sum(e.totals),r.cust_num,e.err_num,e.totals
from e.err_su_stat, reports r
where sum(e.totals) in(
break on report
compute sum of totals on report
select e.err_num,sum(e.totals)
from err_sum_stat e, reports r
where r.rpt_id=e.rpt_id AND
TRUNC(r.run_date) BETWEEN to_date('&run_date1','DD-MON-YYYY') AND
to_date('&run_date2','DD-MON-YYYY')
group by e.err_num
) AND r.rpt_id=e.rpt_id
;
I got the following message:
SQL> @ErrCalcRangeFlnkT.sql
Enter value for run_date1: 04-aug-2004
old 9: TRUNC(r.run_date) BETWEEN to_date('&run_date1','DD-MON-YYYY') AND
new 9: TRUNC(r.run_date) BETWEEN to_date('04-aug-2004','DD-MON-YYYY') AND
Enter value for run_date2: 08-sep-2004
old 10: to_date('&run_date2','DD-MON-YYYY')
new 10: to_date('08-sep-2004','DD-MON-YYYY')
where sum(e.totals) in(
*
ERROR at line 3:
ORA-00934: group function is not allowed here
***************************************************
Is there any way I can do it at all or it is not possible to display other fields calculating totals by jus one of them (err_num)?
Any help would be greately appreciated
Thank you,
Estersita
Recently I got a great help from SantaMufasa (thread 759-911843) with resolving totals calculations problem.I did got totals I needed! Now I realized I also need other fields (except err_num)to be dispayed. Since the nature of Group by does not allow it, I assumed I need a subquery for that purpose:
I tried the following one:
select r.run_date,e.err_descr,sum(e.totals),r.cust_num,e.err_num,e.totals
from e.err_su_stat, reports r
where sum(e.totals) in(
break on report
compute sum of totals on report
select e.err_num,sum(e.totals)
from err_sum_stat e, reports r
where r.rpt_id=e.rpt_id AND
TRUNC(r.run_date) BETWEEN to_date('&run_date1','DD-MON-YYYY') AND
to_date('&run_date2','DD-MON-YYYY')
group by e.err_num
) AND r.rpt_id=e.rpt_id
;
I got the following message:
SQL> @ErrCalcRangeFlnkT.sql
Enter value for run_date1: 04-aug-2004
old 9: TRUNC(r.run_date) BETWEEN to_date('&run_date1','DD-MON-YYYY') AND
new 9: TRUNC(r.run_date) BETWEEN to_date('04-aug-2004','DD-MON-YYYY') AND
Enter value for run_date2: 08-sep-2004
old 10: to_date('&run_date2','DD-MON-YYYY')
new 10: to_date('08-sep-2004','DD-MON-YYYY')
where sum(e.totals) in(
*
ERROR at line 3:
ORA-00934: group function is not allowed here
***************************************************
Is there any way I can do it at all or it is not possible to display other fields calculating totals by jus one of them (err_num)?
Any help would be greately appreciated
Thank you,
Estersita