Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
What is left outer join and right outer join

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
praneethgokul

New User


Joined: 06 May 2005
Posts: 20
Location: Bangalore

PostPosted: Tue Jul 12, 2005 7:19 pm    Post subject: What is left outer join and right outer join
Reply with quote

hi all,


what is left outer join and right outer join?

please give me one example also

how to convert to vsam records to db2 table?
Back to top
View user's profile Send private message
References
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 109

PostPosted: Wed Jul 13, 2005 3:59 pm    Post subject:
Reply with quote

db2 => select tab1.*, childname from tab1 full outer join tab2 on
tab1.empno = tab2.empno
db2 => select tab1.*, childname from tab1 left outer join tab2 on
tab1.empno = tab2.empno
db2 => select tab1.*, childname from tab1 right outer join tab2 on
tab1.empno = tab2.empno

D:\PROGRA~1\SQLLIB\BIN>db2 select * from tab1

EMPNO NAME
----------- --------------------
1 a
2 b
3 c
4 d
5 e

5 record(s) selected.


D:\PROGRA~1\SQLLIB\BIN>db2 select * from tab2

EMPNO CHILDNAME
----------- --------------------
1 a
3 c
4 d
7 x

4 record(s) selected.


D:\PROGRA~1\SQLLIB\BIN>db2 select tab1.*, childname from tab1 left outer
join tab2 on tab1.empno = tab2.empn
o

EMPNO NAME CHILDNAME
----------- -------------------- --------------------
1 a a
2 b -
3 c c
4 d d
5 e -

5 record(s) selected.


D:\PROGRA~1\SQLLIB\BIN>db2 select tab1.*, childname from tab1 right outer
join tab2 on tab1.empno = tab2.emp
no

EMPNO NAME CHILDNAME
----------- -------------------- --------------------
1 a a
3 c c
4 d d
- - x

4 record(s) selected.

D:\PROGRA~1\SQLLIB\BIN>db2 select tab1.*, childname from tab1 full outer
join tab2 on tab1.empno = tab2.empn
o

EMPNO NAME CHILDNAME
----------- -------------------- --------------------
1 a a
3 c c
4 d d
- - x
2 b -
5 e
-
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1