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

What is ems sql management studio? : sql server management studio

1097


What is best institute to Learn DotNET And SQL in chennai?

2159


What is ms sql server reporting services?

1047


What is the synonym of join?

952


How to deploy the Report?

138


How to return the date part only from a sql server datetime datatype?

1094


What is update_statistics command?

1057


Give main differences between "Truncate" and "Delete".

1087


How to configure odbc dsn with different port numbers?

1077


How to generate create view script on an existing view?

978


Are all views updatable ?

1143


What is the difference between char and varchar2 datatype in sql?

1058


how can u get last observation in an unknown dataset ?

2431


Define views.

1001


Explain the usage of floor function in sql server.

954