Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

List out different types of normalizations in sql server and explain each of them?

970


What is a synonym for manipulation?

1044


What are null values in ms sql server?

1140


What is data file in computer?

1000


What are different types of collation sensitivity?

1023


What are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

1056


Can I run multiple instances of sql server 2000 at the same time on one computer?

1119


Does union all remove duplicates?

1123


What is default constraint?

1053


Which operator do you use to return all of the rows from one query except rows are returned in a second query?

1039


what is normalization? Explain different levels of normalization? : Sql server database administration

1410


What is a print index?

932


Ms sql server index?

1101


Explain the use of keyword with encryption. Create a store procedure with encryption?

1005


Difference Between ORDER BY Clause and GROUP BY Clause in SQL?

1102