Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
using OUTER JOIN in SQL query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Vinay Kumar N.J

New User


Joined: 24 Sep 2009
Posts: 1
Location: Bangalore

PostPosted: Thu Sep 24, 2009 7:16 pm    Post subject: using OUTER JOIN in SQL query
Reply with quote

How to use LEFT OUTER JOIN and RIGHT OUTER JOIN in an SQL Query?
Back to top
View user's profile Send private message

ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Sep 24, 2009 7:53 pm    Post subject:
Reply with quote

Use Manuals on top of this page
Back to top
View user's profile Send private message
lkhiger

New User


Joined: 28 Oct 2005
Posts: 89

PostPosted: Fri Sep 25, 2009 9:11 am    Post subject: Re: using OUTER JOIN in SQL query
Reply with quote

Vinay Kumar N.J wrote:
How to use LEFT OUTER JOIN and RIGHT OUTER JOIN in an SQL Query?


You can use LEFT JOIN instead of LEFT OUTER JOIN and never use
RIGHT OUTER JOIN because DB2 replace all RIGHT OUTER JOINs by
LEFT JOINs, which is cost CPU time.

Lenny icon_smile.gif
Back to top
View user's profile Send private message
bhairon singh rathore

New User


Joined: 19 Jun 2008
Posts: 91
Location: banglore

PostPosted: Fri Sep 25, 2009 12:21 pm    Post subject:
Reply with quote

Google and you will find million examples for left outer join.

Check below link: icon_idea.gif
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.apsg/db2z_joinleftouter.htm
Back to top
View user's profile Send private message
ajeshrn

New User


Joined: 25 Mar 2009
Posts: 78
Location: India

PostPosted: Tue Oct 20, 2009 2:15 pm    Post subject:
Reply with quote

Hi Vinay,

Please find a sample left outer query below:

Format 1:

select a.emp_name
,b.emp_desg_des
from
(Select emp_name, emp_desg_cd
from employee)a
LEFT OUTER JOIN
(Select emp_desg_cd,emp_desg_des
from Designation)b
ON a.emp_desg_cd = b.emp_desg_cd

Format 2:

select a.emp_name
,b.emp_desg_des
from employee a
left join Designation b
ON a.emp_desg_cd = b.emp_desg_cd


lkhiger,

Thanks for the information, I never new that DB2 will replace all RIGHT OUTER JOINs by LEFT JOINs, which is cost CPU time.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Oct 20, 2009 3:07 pm    Post subject:
Reply with quote

Quote:
Thanks for the information, I never new that DB2 will replace all RIGHT OUTER JOINs by LEFT JOINs, which is cost CPU time.


that comes as no suprise. you obviously have not read any manuals.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us