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 / harshad lakkad (bapunagar part
For Count Duplicate---
SELECT YourColumn, COUNT(*) TotalCount
FROM YourTable
GROUP BY YourColumn
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
For delete Duplicate---
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2,
DuplicateColumn2)
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is ems sql management studio? : sql server management studio
What is best institute to Learn DotNET And SQL in chennai?
What is ms sql server reporting services?
What is the synonym of join?
How to deploy the Report?
How to return the date part only from a sql server datetime datatype?
What is update_statistics command?
Give main differences between "Truncate" and "Delete".
How to configure odbc dsn with different port numbers?
How to generate create view script on an existing view?
Are all views updatable ?
What is the difference between char and varchar2 datatype in sql?
how can u get last observation in an unknown dataset ?
Define views.
Explain the usage of floor function in sql server.