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

if 3 duplicate records in a table,i want to delete 2 duplicate
records by keeping 1 as it is,how?

Answer Posted / venkat

if u r table like this
sno sname fee
1 a 1000
1 a 1000
2 b 1000
2 b 1000
3 c 1000
3 c 1000
--- write this
with duplicatecte
as
(select row_number()over(partition by sno,sname order by fee
)as rnum from students )
delete from dupcte where rnum>1

---run this query
select * from students
--out put is
1 a 1000
2 b 1000
3 c 1000

this is correct

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is database replicaion? : Sql server database administration

1177


What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?

1069


Can a trigger be created on a view?

948


Explain primary key in sql server?

1009


What is a data collection table?

1001


How to fetch the next row from a cursor with a "fetch" statement?

1065


What are the new data types are introduced in sql 2000?

895


How to connect to a sql server using odbc_connect()?

1140


How can you find out how many rows returned in a cursor?

1020


tell me what are the steps you will take to improve performance of a poor performing query? : Sql server database administration

1015


How to list all login names on the ms sql server?

1131


what is the sql equivaent of the dataset relation object ?

2014


what is dbcc? : Sql server database administration

1021


Mention the command used to rename the database.

997


Explain some stored procedure creating best practices or guidelines?

924