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
 

 

Using INNER JOIN.... in DB2 for iseries V5R3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
krish_mrt

New User


Joined: 15 Apr 2005
Posts: 12
Location: Chennai

PostPosted: Fri May 13, 2005 9:17 pm    Post subject: Using INNER JOIN.... in DB2 for iseries V5R3
Reply with quote

Hi!

pls suggest which of the two queries fetch result set faster.
option - 1
Code:
select tab1.a1,tab2.x2
from tab1,tab2
where tab1.a1 = 'aaa'
and tab1.a3 = tab2.x1


option - 2
Code:
select tab1.a1,tab2.x2
from tab1 inner join tab2
               on tab1.a3 = tab2.x1
where tab1.a1 = 'aaa'


Note:
1.index has been created on tab1(a1) and on tab2(x1)
2.row count of both the tables are 60,000+
Back to top
View user's profile Send private message

ajay_dheepak

New User


Joined: 12 May 2005
Posts: 32
Location: Chennai

PostPosted: Thu May 19, 2005 5:26 pm    Post subject:
Reply with quote

I believe its Option-2. Because first the join is made and then the where clause is executed. icon_rolleyes.gif
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm
No new posts Join key - Populate Zeros when Unpair... rexx77 DFSORT/ICETOOL 6 Thu May 12, 2016 12:22 am


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