Suppose there are many duplicate records in a Db2 table.
What is the query to retrive only duplicate records?

Answer Posted / azharuddinsyed

SELECT <COLUMN_1> FROM TABLENAME
GROUP BY COLUMN_1
HAVING COUNT(COLUMN_1) > 1

OR

SELECT <COLUMN_1> FROM TABLENAME
GROUP BY COLUMN_1
HAVING COUNT(*) > 1

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is null in db2?

653


What is performance tuning db2?

734


How do I delete a table in database?

691


i tried to copy some records from microsoft excel to as-400 physical file through "Bosanova" emulation. Out of 14000 records only 12000 records copies and subsequently programe started to hang. Then, i closed the program forcefully. I did' under stand the problem. Also when i try to compile the physical file it is showing as "The file in use". How to overcome this problem?

2152


What is dbrm? What it contains? When it will be created?

677






Is db2 a database?

652


How to check table size in db2 sap?

668


How to view db2 table structure?

684


If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?

801


What do you mean by cursor?

684


What is the purpose of using commit?

712


How do I add a column to a table in db2?

713


What is cursor in dbms?

700


What is db2? Explain.

690


What is the difference between drop table and delete table?

653