How we can eliminate duplicate records using SQL query.
Problem is :
Suppose there are two tables: TABLE1 (10 columns) & TABLE2(7 columns).
I need to eliminate duplicate from these two tables. 5 columns are
common in these
tables. With the help of Group By,Order By and Having condition how we
can eliminate
duplicates.
Can anyone give me more information regarding this.
Thanks,
Pradeep
Serge Rielau - 16 Apr 2006 15:07 GMT
> How we can eliminate duplicate records using SQL query.
>
[quoted text clipped - 8 lines]
> duplicates.
> Can anyone give me more information regarding this.
Can you provide example data and output?
Given that you have two tables it's not obvious what you mean by
duplicate records. Also it's important to know whether there is a
primary key.
You are on DB2 zOS?
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
m_v_ratnam - 16 Apr 2006 21:00 GMT
select table1.columns1,
table1.columns2,
table1.columns3,
table1.columns4,
table1.columns5,
from TABLE1
union
select table2.columns1,
table2.columns2,
table2.columns3,
table2.columns4,
table2.columns5,
from TABLE2
will reasult in rows with out duplicate records
Pradeep - 25 Apr 2006 17:42 GMT
I will Try this Method and will send feedback ASAP.
Thank You,
Ratnam