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 / 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


Please Help Members By Posting Answers For Below Questions

How to configure odbc dsn with different port numbers?

1079


How to update multiple rows with one update statement in ms sql server?

1198


What are the properties of the transactions?

1111


What is the use of floor function in sql server?

1074


How to copy data from one table to another table?

993


What is the use of attributehierarchyvisible ? : sql server analysis services, ssas

1062


What are the database objects? : SQL Server Architecture

1037


Define tempdb database?

986


What are partitioned views and distributed partitioned views?

1016


When would you use it?

982


What is logon trigger?

1083


Where do you find the default Index fill factor and how to change it?

1057


How to insert stored procedure result into temporary table?

1011


What is the tcp/ip port on which sql server runs?

1144


How to include date and time values in sql statements?

1079