one of the column in my table contains the data like
SAL
----
1000
1000
2000
3000
3000
So my requirement is i want output like
SAL
---
1000
2000
3000
it mean i want to delete duplicate rows only how should u
write query?
Answers were Sorted based on User's Feedback
Answer / yaswanth
delete from employees where rowid NOT IN(select max(rowid) from employees GROUP BY salary)
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / annalakshmi.s
select distinct(salary) from tablename
Example:
employee is the table name
salary is the column name means
select distinct(salary) from employee
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / hiya
select n from (select row_number()over (partition by n order
by n) r,n from test group by n having count(*)>1)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / manju
Select sal from emp group by sal having count(*)>=1
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / swastik
DELETE FROM Emp A
WHERE ROWID NOT IN
(
SELECT MIN(ROWID)
FROM Emp B
WHERE A.Sal = B.Sal
)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sandeep sudunagunta
Select sal form from my_table group by sal having count(*)>1
| Is This Answer Correct ? | 1 Yes | 1 No |
What is forward declaration in pl sql?
What is meant by temporal data?
How can you create Cursor with parametres ?
Mention what pl/sql package consists of?
Can a view be updated/inserted/deleted?If Yes under what conditions?
what are all the different types of indexes? : Sql dba
How is indexing done in search engines?
What is an invalid partition table?
How do we use distinct statement? What is its use?
Explain what is a column in a table?
what is Hash join?how it is different from inner join?what is the sign used for inner join?(eg: like the (+) sign used for outer join)?
What is difference between rank () row_number () and dense_rank () in sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)