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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To Discard record with 0 entry if Dup... SYNCSORT 7
No new posts Question regarding ISPF tables with T... TSO/ISPF 11
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts how to eliminate null indicator value... DB2 7
No new posts Reflection 3270 screen shows only 23 ... Compuware & Other Tools 6
Search our Forums:


Back to Top