View previous topic :: View next topic
|
Author |
Message |
Vinay Kumar N.J
New User
Joined: 24 Sep 2009 Posts: 1 Location: Bangalore
|
|
|
|
How to use LEFT OUTER JOIN and RIGHT OUTER JOIN in an SQL Query? |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Use Manuals on top of this page |
|
Back to top |
|
|
lkhiger
New User
Joined: 28 Oct 2005 Posts: 89
|
|
|
|
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 |
|
Back to top |
|
|
bhairon singh rathore
New User
Joined: 19 Jun 2008 Posts: 91 Location: banglore
|
|
Back to top |
|
|
ajeshrn
New User
Joined: 25 Mar 2009 Posts: 78 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
|