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 To get Non matching row after compari... vinu78 DB2 7 Fri Jan 05, 2018 5:43 pm
No new posts DB2 catalog tables Pavan kumar chauhan DB2 8 Thu Dec 21, 2017 6:32 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts Selecting a row from multiple tables! Vignesh Sid DB2 2 Thu Oct 26, 2017 6:09 pm

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