{section}{column:width=50%}


select inp_date, sum(inp_amt), sum(out_amt)
from ACCOUNT a,
   (select MANAGE_NUM, substr(INPUT_DATE,1,6) inp_date,
           sum(AMT) inp_amt
    from INPUT
    where INPUT_DATE between '20060301' and '20060430'
    group by MANAGE_NUM, substr(INPUT_DATE,1,6)) b,
   (select MANAGE_NUM, substr(OUTPUT_DATE,1,6) out_date,
           sum(AMT) out_amt
    from OUTPUT
    where OUTPUT_DATE between '20060301' and '20060430'
    group by MANAGE_NUM, substr(OUTPUT_DATE,1,6)) c
where b.MANAGE_NUM = a.MANAGE_NUM
  and c.MANAGE_NUM(+) = b.MANAGE_NUM
  and c.out_date(+) = b.inp_date
  and a.DEPT_COD = 'AA'
group by inp_date;

{column}{column:width=50%}



Execution Plan
----------------------------------------------------------
Plan hash value: 3268376330
----------------------------------------------------------------------------------
| Id | Operation         | Name    | Rows | Bytes | Cost (%CPU)|   Time   |
----------------------------------------------------------------------------------
| 0  |SELECTSTATEMENT    |         |  9   | 630   | 13 (31)    | 00:00:01 | 
| 1  | HASHGROUPBY       |         |  9   | 630   | 13 (31)    | 00:00:01 | 
|* 2 | HASH JOIN OUTER   |         |  9   | 630   | 12 (25)    | 00:00:01 | 
|* 3 | HASH JOIN         |         |  9   | 378   | 8 (25)     | 00:00:01 | 
|* 4 | TABLE ACCESS FULL | ACCOUNT |  3   | 42    | 3 (0)      | 00:00:01 | 
| 5  | VIEW              |         |  9   | 252   | 4 (25)     | 00:00:01 | 
| 6  | HASHGROUPBY       |         |  9   | 234   | 4 (25)     | 00:00:01 | 
|* 7 | TABLE ACCESS FULL | INPUT   |  9   | 234   | 3 (0)      | 00:00:01 | 
| 8  | VIEW              |         |  9   | 252   | 4 (25)     | 00:00:01 | 
| 9  | HASHGROUPBY       |         |  9   | 234   | 4 (25)     | 00:00:01 | 
|*10 | TABLE ACCESS FULL | OUTPUT  |  9   | 234   | 3 (0)      | 00:00:01 | 
---------------------------------------------------------------------------------- 
Predicate Information (identifiedbyoperation id): 
--------------------------------------------------- 
2 - access("C"."MANAGE_NUM"(+)="B"."MANAGE_NUM"AND"C"."OUT_DATE"(+)="B"."INP_DATE") 
3 - access("B"."MANAGE_NUM"="A"."MANAGE_NUM") 
4 - filter("A"."DEPT_COD"='AA') 
7 - filter("INPUT_DATE">='20060301' AND"INPUT_DATE"<='20060430') 
10 - filter("OUTPUT_DATE">='20060301' AND"OUTPUT_DATE"<='20060430')

{column}{section}