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

How will you find out if there are expensive SQL statements running or not?

969


Explain four layers of abstraction microsoft architectured?

147


Define indexes?

999


How do you Implement SSIS Packages in your Project?

1872


If a user does not have permission to a table, but has permission to a view created on it, will he be able to view the data in table?

887


What is subquery in sql?

989


what types of replication are supported in sql server? : Sql server database administration

959


Explain the flow of creating a cube? : sql server analysis services, ssas

1005


How to perform key word search in tables?

914


Which is faster statement or preparedstatement?

894


What is lookup override?

964


How can I check if a view exists in a sql server database?

984


How to check table values in sql server?

913


How to define and use table alias names in ms sql server?

1044


Can we do dml on views?

917