Page 1 of 1

Creating the Reject files for Source and Refrence tables

Posted: Thu Feb 04, 2010 4:21 am
by shivakumar
Hi ,

I am having 2 Tables Product and Category. My requirement is I have to capture the records those are present in Product table and not found in Category table and Vice versa in a single job. The common key is product _id.

PRODUCT CATEGORY
*********** ***************
PROD ID CATG_ID CATG_ID CATG_NAME PROD ID
1 100 100 ABC 1
2 101 101 PQR 2
3 102 103 RTS 4

Now in Project reject file I have to get " 3 102 " and CATEGORY reject I have to get " 103 RTS 4" .

Can anyone please tell me how to resolve this?

Thanks and Regards
Siva

Re: Creating the Reject files for Source and Refrence tables

Posted: Thu Feb 04, 2010 6:33 am
by chulett

Code: Select all

PRODUCT                                    CATEGORY
***********                                ***************
PROD ID       CATG_ID                      CATG_ID  CATG_NAME   PROD ID
1             100                          100      ABC         1
2             101                          101      PQR         2
3             102                          103      RTS         4
There you go, all better. Code tags, people, code tags preserve white space.

Posted: Thu Feb 04, 2010 10:27 am
by Sainath.Srinivasan
Either a full outer join.....

OR

Code: Select all

SELECT *
FROM
(
SELECT table1_columns, add_table2_Columns
UNION ALL
SELECT add_table1_columns, table2_Columns
)
GROUP BY
   yourKeyField
HAVING count(*) <> 2