Write a query to delete duplicate records in SQL SERVER

Answer Posted / nag

create table MMM(Name varchar(20),age int)
select * from MMM
insert into MMM values('MIKE',20)

insert into MMM values('Shuck',30)

insert into MMM values('Shuck',30)

insert into MMM values('Sh',90)
insert into MMM values('Shuc',60)
insert into MMM values('Sonu',70)
insert into MMM values('Siddu',80)
insert into MMM values('nagu',50)

SELECT name,age
FROM mmm
GROUP BY name,age
HAVING count(*) <=1

Try this query friends it will work out

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Retrieve the unique rows from table without using UNIQUE and DISTINCT keywords.

593


Distinguish between commit and rollback?

553


Can you explain about buffer cash and log cache in sql server?

506


How to configure and test odbc dsn settings?

577


What is nonclustered index with included columns ?

554






What are the advantages of passing name-value pairs as parameters?

665


Define cross join in sql server joins?

591


What is difference between group by and having?

566


Define cursor locking

552


What is similarity and difference between truncate and delete in sql?

593


what is the sql equivaent of the dataset relation object ?

1573


What are the basic features of a trigger in ms sql server?

569


What do you understand by triggers and mention the different types of it?

488


When would you use sql joins?

528


What stored procedure would you use to view lock information?

531