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
 
Retrieving all rows from two or more tables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Retrieving all rows from two or more tables
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: 238
Location: USA

PostPosted: Wed Jun 29, 2005 4:33 am    Post subject:
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: 680
Location: NJ

PostPosted: Thu Nov 03, 2005 2:27 pm    Post subject: selecting multiple rows
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    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 Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts retrieving envelope information out o... VintageReceiver TSO/ISPF 6 Thu Aug 10, 2017 8:13 pm
No new posts Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am

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