How will you delete duplicate records from a table?

Answer Posted / naresh.s

in DB2
first we need to know duplicate records in database file
like tmpfilep ,for that

select RRN(A) from tmpfilep A where field='fieldvalue'

here field means any fileld containd tmpfilep and
corresponding value.

once we execute the above query we will get relative record
numbers of each row and remember that numbers
now you can delete records based on these numbers

delete from tmpfilep A where rrn(A) in (234,341,642)

here 234,341,642 are sample record numbers

may be i am correct upto my knowledge.......

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do chiropractors use drop table?

663


What are the uses of db2 optimizer?

819


Define db2.

672


What is precompiler in db2?

587


What is the use of predicate?

588






What is difference between alias and synonym in db2?

645


Discuss about db2 bind?

673


Explain packages.

666


Can we update view in db2?

562


What is blu acceleration in db2?

608


File not opened because library is *PROD and debug is UPDPROD(*NO). ? what may be the reason? how to solve it..?

2379


How do I add a column in db2?

596


What is db2 purescale?

551


I HAVE 500 ROW TO UPDATE I WOULD LIKE TO USE ROLLBACK ALONG WITH COMMIT.WHAT IS THE SYNTAX TO CODE COMMIT AND ROLLBACK FOR EVERY 100 ROWS.AND HOW THE CURSOR ROLLBACK TO THE LAST COMMITTING POINT.

2757


How and when does the db2 enforces the unique key?

616