how to get duplicate records from tables?write qurey for this?
Answers were Sorted based on User's Feedback
Answer / anshuman
Select column_name1,column_name2
from table_T
group by column_name1 having count(*)>1
it will give all the duplicates value of column_name1
Is This Answer Correct ? | 28 Yes | 7 No |
Answer / mahesh babu
select column_name,count(*) from table_name group by
column_name having count>1.
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / naresh k
select * from table_name;
The above qurey get duplicate record also because the
database store records like multi-set..
if we want get distinct records then use following query.
select distinct(attribute_name) from table name
Is This Answer Correct ? | 0 Yes | 15 No |
Answer / pandu
To get the duplicate records in a table use the query
Select distinct(deptno) from emp;
reply any one to me am i correct.
Is This Answer Correct ? | 2 Yes | 26 No |
How would you print the output of an SQL statement from SPUFI?
What is a clustering index?
Why do we need to create an alias if we can directly use the table name? What are the benefits of referring a table name by its alias? Also, when should we go for alias and when for synonyms?
What is db2 bind process?
What is null value in db2?
Can we use group-by clause in sub-query? If 'yes' means,Will it be executed successfully or else If 'no' means why should we not using that method? Give me your suggestion please....
How to design maps
what is static sql? what is dynamic sql? Give me details
Hi All, In a Cobol-DB2 program, I am fetching rows from 4 tables using cursor and then based on the a field present in that table, It processes the information accordingly..for example stat-c is one digit field..if stat-c is 'D' then the a row is deleted from table and written those details in to a file. If the stat-c is 'U' then a row is updated (hardcoded what to update)in a table and written those details in to a file. If the stat-c is 'I' then a row is inserted in a table and written those details in to two files. The issue is i have to include the intermediate commits. When an abend occurs, due to commit statement db2 tables will be saved, But there will be lose of file contents. When we resubmitting the job associated with this program there will be insert ,update and delete anomolies to avoid that what measures could be taken?. The intermediate commit is nothing but issuing commit after massive inserts, updates and deletes(sum of 500actions)
How can tablespace be moved to another dasd volume that is allocated for that tablespace?
what is the use of cursors?
how can u retrieve the data from null values using applicaion program.