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

Retrieving all rows from two or more tables


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

New User


Joined: 24 Jun 2005
Posts: 5

PostPosted: Tue Jun 28, 2005 11:17 am
Reply with quote

If I have a table EMP (eno,ename,esal) and another table DEPT(deptno,deptname,deptcode) then if i want to retreive all the rows
from both the tables then what will be the query. I dont want to use
UNION ALL for that query.
Back to top
View user's profile Send private message
mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 237
Location: USA

PostPosted: Wed Jun 29, 2005 4:33 am
Reply with quote

seema_vaidya,


Code:
SELECT ENO, ENAME, ESAL, DEPTNO, DEPTNAME, DEPTCODE FROM EMP, DEPT


This will retrieve all the rows from both the tables

Hope this helps

Regards
Mayuresh
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Nov 03, 2005 2:27 pm
Reply with quote

hi frnd,
hope the following query will do

1>>> SELECT E.*,D.*
FROM EMP E,DEPT D;

OR

2>>> SELECT E.ENO,E.ENAME,D.DNO,D.DNAME
FROM EMP E,DEPT D
WHERE E.DNO=D.DNO;
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 To get the count of rows for every 1 ... DB2 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts How to compare two rows of same table DB2 11
Search our Forums:

Back to Top