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?



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

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

More SQL Server Interview Questions

What is the use of stored procedure?

0 Answers  


How to apply cascading referential integrity in place of triggers?

0 Answers  


What are the difficulties faced in cube development? : sql server analysis services, ssas

0 Answers  


What do you understand by recursive stored procedure?

0 Answers  


Explain what is the main purpose of having conversation group?

0 Answers  


Differentiate between ms sql server reporting services vs crystal reports?

0 Answers  


What is a Lock and let me know Different types of locks?

2 Answers  


What are pages and extents? : SQL Server Architecture

0 Answers  


What is an indexing technique?

0 Answers  


What is sub query and its properties?

0 Answers  


How do you create type- insensitive operator?

0 Answers   EXL,


Differences between functions and stored procedures?

8 Answers   247Customer, Accenture,


Categories