Exclude some columns in a select group by statement [message #2028] |
Mon, 17 June 2002 21:55 |
ajay
Messages: 45 Registered: December 2000
|
Member |
|
|
I am selecting a set of 10 columns. the table to which I am inserting has 4 columns as primary key...
When I retrieve I get duplicates keys failure as some duplicate records are getting selected...
Within the SQL statement how I can I ensure that I retrieve only unique records for the primary key combination ?
|
|
|
|
Re: Exclude some columns in a select group by statement [message #2032 is a reply to message #2028] |
Tue, 18 June 2002 05:10 |
lakshmi
Messages: 22 Registered: July 2000
|
Junior Member |
|
|
try this .. this will eliminate the duplicate records
delete from table_name
where rowid in (select a.rowid from table_name a,table_name b
where a.rowid < b.rowid
and a.primary_key1 = b.primary_key1
and a.primary_key2 = b.primary_key2
and a.primary_key3 = b.primary_key3
and a.primary_key4 = b.primary_key4
|
|
|