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
 

 

How to eliminate duplicate rows from two tables?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to eliminate duplicate rows from two tables?
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: 3158
Location: Tucson AZ

PostPosted: Wed Feb 07, 2007 1:14 am    Post subject:
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    Post subject:
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    Post subject: Re: How to eliminate duplicate rows from two tables?
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    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 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
No new posts To know activities on db2 tables ashek15 DB2 4 Fri Mar 03, 2017 11:23 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts ERM-Diagram of SysIBM-Catalog-Tables Auryn DB2 2 Fri Feb 17, 2017 6:22 pm


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