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

Differentiate between SQL and ORACLE joins and write their syntax.

1071


What is @@error in sql?

1108


What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?

2414


Do you know what are the ways available in sql server to execute sql statements?

1082


Give an example of why you would want to denormalize a database

1029


Explain view in sql server?

1091


Explain system functions or built-in functions? What are different types of system functions?

1041


What are different types of raid configurations? : SQL Server Architecture

1133


Would you store your query in a ssrs report or a database server? State the reason why?

157


What is the default schema of your login session in ms sql server?

1092


What is normalization 1nf 2nf 3nf?

1109


Explain trigger and its types?

1115


What are the pros and cons of putting a scalar function in a queries select list or in the where clause?

1267


Difference between drill down and drill through report.

1003


Explain the various types of concurrency problem?

1241