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 in the table
permanently and i want output in the above formatow should u
write query?
Answers were Sorted based on User's Feedback
Answer / guest
SQL> DELETE FROM <TABLE_NAME>
WHERE (ROWID,SAL) NOT IN
(SELECT MIN(ROWID),SAL FROM <TABLE_NAME>
GROUP BY SAL);
| Is This Answer Correct ? | 13 Yes | 5 No |
Answer / yaswanth
select salary from emp where rowid NOT IN(select max(rowid) from emp GROUP BY salary);
| Is This Answer Correct ? | 14 Yes | 7 No |
Answer / amit
SQL>DELETE FROM <TABLE NAME>
WHERE ROWID NOT IN (SELECT MIN(ROWID) FROM <TABLE NAME>
GROUP BY SAL);
| Is This Answer Correct ? | 9 Yes | 3 No |
Answer / sarthak mohanty
DELETE
from <table_name> a
where a.rowid > ANY(select b.rowid
from <table_name> b
where a.salary=b.salary);
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / bibhudatta panda
DELETE FROM TABLENAME
WHERE ROWID NOT IN(
SELECT MAX(ROWID)
FROM TABLENAME
GROUP BY Sal
)
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / abin
Select sal from (Select *,ROW_NUMBER() over (partition by
sal order by sal asc)num from emp) a
Where num=1
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / guest
http://www.youtube.com/watch?v=3bCgGrEz8Kw&NR=1
bug
http://www.youtube.com/watch?v=zZdQ6HXXDiE&feature=related
levels of testing
http://www.youtube.com/watch?v=osgaXV4qtZg
software testing
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / suneelkumar
delete from emp x where rowid>(select rowid from emp y where
x.sal=y.sal)
| Is This Answer Correct ? | 0 Yes | 0 No |
Name the different types of indexes in sql and define them.
Which one is better subquery or joins?
how to write date and time literals? : Sql dba
How can check sql version from command line?
What are the types of operators available in sql?
What does select * from mean in sql?
Is sql a case sensitive language?
What is union and union all keyword in sql and what are their differences?
How can I create a table from another table without copying any values from the old table?
What is a record in a database?
How many tables can you join in sql?
I need to write a simple query,which one is better select statement or stored procedure?and why?
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)