Creating the Reject files for Source and Refrence tables

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
shivakumar
Participant
Posts: 31
Joined: Wed Mar 17, 2004 3:33 am

Creating the Reject files for Source and Refrence tables

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Creating the Reject files for Source and Refrence tables

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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
Post Reply