I have a table EMP in which the values will be like this
EmpId Ename Sal DeptId
11 Ram 10000 10
11 Ram 10000 10
22 Raj 20000 20
22 Raj 20000 20
33 Anil 15000 30
33 Anil 15000 30
I want to delete only duplicate Rows. After Delete I want
the output like this
EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30
Answer Posted / vijay
I have tried this query in my PC.Very simply I was able to
remove all duplicate rows.
Please try below query it will work out.
SELECT DISTINCT*FROM EMP(TableName);
You will get below table
EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30
Suppose if you have different ENAME but you want only
selected ENAME without duplicate records.
Where We can use below query.
SELECT DISTINCT*FROM EMP WHERE ENAME IN('RAM','RAJ','ANIL');
Please correct me if I am wrong.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
How to add the custom code in Report?
Does table partitioning improve performance?
What does ss stand for sexually?
What are the different Authentication modes in SQL Server and how can you change authentication mode?
How does stuff differ from the replace function?
List out the difference between union and union all in sql server?
Why I am getting this error when dropping a database in ms sql server?
What is the recovery model?
Why normalization is used?
Why I am getting "the microsoft .net framework 2.0 in not installed" message?
What are audit control procedures?
Call by value and call by reference in procedure and function, with NOCOPY.
How can you tell if a database object is invalid?
What is the difference between functions and stored procedures?
Write an sql query to sort a table according to the amounts in a row and find the second largest amount.