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

Why JOIN is more advantageous than UNION


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sudhakar.harish
Warnings : 1

New User


Joined: 06 Dec 2006
Posts: 3
Location: ERNAKULAM

PostPosted: Wed Dec 06, 2006 10:53 pm
Reply with quote

May i know why join is more advantageous than union
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri Dec 08, 2006 12:56 am
Reply with quote

Harish,

Join and Union cannot be compared as one is more advantageous than the other. The serve different functions.

Think of the union and join as concatenations.

A ?Union? concatenates ?rows? together and must have the same structure. So if you ?union? 2 tables together that have the same structure. Say both have 25 columns (need to match definition), one has 1000 rows and the other 2500 rows, the union will result in 3500 rows, or less depending upon if you use ?union all? or not.

A ?join? concatenates ?columns? together from multiple tables. So if you join 2 tables together, one with 25 columns and one with 50 columns, the resultant row will have 75 columns. Please read up on inner and outer joins for rules on how the joins work.

Dave
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 Join multiple records using splice DFSORT/ICETOOL 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Join files where value in one is betw... DFSORT/ICETOOL 6
No new posts Is the Output of Sort/Join dependent ... DFSORT/ICETOOL 2
Search our Forums:

Back to Top