Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us