Join 2 tables on a key without using lookup

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rishabh
Participant
Posts: 24
Joined: Mon Apr 10, 2006 11:40 pm

Join 2 tables on a key without using lookup

Post by rishabh »

hello,

I am using server edition 7.5.1

I am want to join two diff tables from DB2 WITHOUT using lookup stage(hashed file)

reply soon
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You can do a lookup directly to a DB2 table from a transform stage in DataStage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Just specify the join in your SELECT statement, like you would if you didn't have DataStage. This is the most efficient mechanism in general.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

User defined SELECT query in stage......

Thanks,
ANupam
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Doesn't need to be user-defined. You can generate a query containing join criteria. Simply put a comma-separated list of table names into the Table Name field, and the join criteria into the WHERE field on the Selection tab. In the Columns grid make sure that no ambiguities exist by using fully-qualified column names in the Derivation field.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

If you are using Database stage then you can define INNER,RIGHT,LEFT, IN, NOT IN... manually in user-defined query...OCI consits of IN, NOT IN but RIGHT,LEFT outer join is not there...If you write user defined query you can tune query in your own way...

Thanks,
Anupam
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or you can use the 'old' style outer syntax - (+) - in the generated sql which will get you everything but a full outer join. User defined sql is a... PITA... and should be avoided if at all possible. IMHO. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
pkomalla
Premium Member
Premium Member
Posts: 44
Joined: Tue Mar 21, 2006 6:18 pm

Post by pkomalla »

You can use the database stage as reference link with where clause in select statement. Or if you want to do aggregations in the reference stage u need to use groupby and having clauses.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Join 2 tables on a key without using lookup

Post by gateleys »

There you go. You've got a whole bunch of suggestions. But Rishabh, any reason why you would NOT want to use the hashed file for reference? Just curious.

gateleys
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

chulett wrote:Or you can use the 'old' style outer syntax - (+) - in the generated sql which will get you everything but a full outer join.
Isn't the (+) syntax only for Oracle? It's not part of the SQL CAE Access Group's standard.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, sorry... forgot not all peoples live on Planet Ellison. :cry:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

:?:

This would be Oracle bin Larry to whom you're referring as "Ellison"?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes sir. That would be correct, sir.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply