Please give me queries for the following
1. To get the count of duplicate records.
2. A query to delete the duplicate records.
Answer Posted / meher
1. To get the duplicate records.
Use group by clause to the column on which you want to
check the duplicates records.
syntax:
select column_name, count(*) from table_name group by
column_name having count(*) >1
2. To delete the duplicate records.
syntax:
delete from table_name where rowid in (select max(rowid)
from table_name group by column_name having count(*)>1 )
This will work.
Please let me know in case of any issues.
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is a subquery in a select query statement in ms sql server?
How to define the name and server for a new dsn?
What is the fillfactor concept in indexes?
What is the cpu pressure?
How to name query output columns in ms sql server?
What are entities and relationships?
How to loop through result set objects using odbc_fetch_row()?
What is ddl command?
What is the difference between sql server 2000 object owner and sql server 2005 schema? : sql server database administration
What are the different types of triggers in SQL SERVER?
What are drillthrough reports?
What is raiseerror? What is raiseerror?
Define clusters?
What is a trigger in sql server?
What do you understand by the analysis services in sql server?