Posted on 2005-05-02
I have two tables i want to retrive those rows which matches as well as not matching query. I am doing outer join.
RRS_SPK_UNALLOC_BUD_STG --- > 48 rows
RRS_BUDGET_TGT --- > 22495
It should return me 22543 . It is returning me those rows. But RRS_SPK_UNALLOC_BUD_STG has 4 rows not matching with other tables . It shows me duplicate value.
I do following query.
A.YEAR_END_DATE,NVL(B.BUDGET,0), (NVL(A.BUDGET_AMOUNT,0) + NVL(B.BUDGET,0)) TOTAL FROM
WHERE A.DEPARTMENT = B.DEPT_ID (+)
AND A.EXPENSE_CODE = B.SUB_ACCOUNT (+)
AND A.YEAR_END_DATE = B.END_OF_YEAR_DATE (+)
(nvl(c.budget,0) + nvl(c.budget,0)) Total from rrs_spk_unalloc_bud_stg C where exists
B.END_OF_YEAR_DATE,NVL(B.BUDGET,0), (NVL(A.BUDGET_AMOUNT,0) + NVL(B.BUDGET,0)) TOTAL FROM
WHERE A.DEPARTMENT = B.DEPT_ID
AND A.EXPENSE_CODE = B.SUB_ACCOUNT
AND A.YEAR_END_DATE = B.END_OF_YEAR_DATE
I just want to see 22495 rows + 4 rows from RRS_SPK_UNALLOC_BUD_STG table which are not matched.