IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is left outer join and right outer join


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
praneethgokul

New User


Joined: 06 May 2005
Posts: 20
Location: Bangalore

PostPosted: Tue Jul 12, 2005 7:19 pm
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
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Wed Jul 13, 2005 3:59 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Join files where value in one is betw... DFSORT/ICETOOL 6
Search our Forums:

Back to Top