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

How to eliminate duplicate rows from two tables?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Wilfred
Currently Banned

New User


Joined: 06 Feb 2007
Posts: 5
Location: bangalore

PostPosted: Wed Feb 07, 2007 12:59 am
Reply with quote

Hi All

Can any one tell me how to eliminate duplicate rows from two tables? please! i know to eliminate duplicate rows from a table we can use DISTINCT. but for from two tables?

Thank you
Regards
Wilfred
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 07, 2007 1:14 am
Reply with quote

I obviously do not understand because my first suggestion would be to use two DISTINCTs.....But I don't expect that is what you want....
Could you expand on the problem a little?
Back to top
View user's profile Send private message
Wilfred
Currently Banned

New User


Joined: 06 Feb 2007
Posts: 5
Location: bangalore

PostPosted: Thu Feb 08, 2007 9:37 pm
Reply with quote

Hi

i mean to say, i have tableA and tableB, and i want to eliminate duplicate rows from these two tables.

I think we can use logic UNION and UNION ALL

UNION IS FOR TO ELIMINATE DUPLICATE ROWS AND
UNION ALL IS GET THE DUPLICATE ROWS.

CORRECT ME IF AM WRONG!
THANKS
WILFRED!
Back to top
View user's profile Send private message
rajeshps19

New User


Joined: 14 Feb 2007
Posts: 4
Location: Noida

PostPosted: Wed Feb 14, 2007 4:10 pm
Reply with quote

Hi Wilfred,

Yes, that's right.

UNION will eliminate all duplicate rows whereas UNION ALL will retain them.

Rajesh.
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 To get the count of rows for every 1 ... DB2 3
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Duplicate several members of/in one l... JCL & VSAM 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
Search our Forums:

Back to Top