Left Outer Join More than One column?

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
pkll
Participant
Posts: 73
Joined: Thu Oct 25, 2012 9:45 pm

Left Outer Join More than One column?

Post by pkll »

Hi All,

Please let me know whether this left outer join is correct? If correct will it effect the performance because I am using join with more than one columns.
both tables are in database so can I use the SQL join or data stage join. left table contain millions of records.

SELECT a.contractno, b.prism id
FROM Contract
LEFT OUTER JOIN prism
ON a.prism_cont_num = b.prism_cont_num
AND table1.product_cd = b.product_cd
and a.tie_breaker=b.tie_breaker
and a.contract_type=b.contract_type
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How can we say if it is 'correct' or not? Check the explain plan. Run it. Check the results. Then you'll know if it is correct or not.

A join is still a join no matter if it is left, right, inner or outer, regardless of the number of columns you are joining and it will may need indexes on the join columns to perform well. You'll get all contracts with or without matching prism data... as long as you fix your aliases.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

Re: Left Outer Join More than One column?

Post by ssnegi »

you would need to define which tables are using the aliases "a", "b", "table1"
Post Reply