DS Select not in another table

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
selina_king
Participant
Posts: 21
Joined: Fri Jul 29, 2011 8:02 am

DS Select not in another table

Post by selina_king »

Hello, everyone! I am new here. This is my first time post the topic. First allow me thank all the people who answer my question.

I want to select a result from table A, but A. ID NOT IN B. ID.

EXP:
SELECT A.ID,A.NAME FROM A,B WHERE A.ID <> B.ID.

How can I achieve this.

Table A and table B not in the same database.

I want to user 2 DB2 STAGE.

Thank you very much.
krishnakanth.patil@wipro.
Participant
Posts: 2
Joined: Tue Sep 07, 2010 3:23 am

Post by krishnakanth.patil@wipro. »

select ID , Name from A
where ID not in (select Id From B)
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

i guess there should be a db link for achieving this..since both tables are from different databases.. someone correct me if i am wrong..
pandeeswaran
rbpty
Premium Member
Premium Member
Posts: 6
Joined: Sat Jun 21, 2008 7:58 am

Post by rbpty »

You can do this in datastage by doing a lookup on two tables using a lookup stage and then filtering the output of the lookup stage in transformer for null/blank records from the second table. This is like executing a below statement in SQL..

select A.*
from
Table A,
Table B
where
A.ID = B.ID(+) and B.ID is null
selina_king
Participant
Posts: 21
Joined: Fri Jul 29, 2011 8:02 am

Post by selina_king »

pandeesh wrote:i guess there should be a db link for achieving this..since both tables are from different databases.. someone correct me if i am wrong..
You are right, Two tables not in a same Database. So I want to quary A.ID <>B.ID . Which stage I can use. I do not like lookup stage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You will need to use Lookup stage (or, possibly, Merge stage with appropriate unmatched masters handling). What don't you like about Lookup stage?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply