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 |
How many types of tables are there?
What found sql?
Which column of the user triggers data dictionary view displays the database event that will fire the trigger?
Explain character-manipulation functions?
What are the popular database management systems in the it industry?
How do I find duplicates in two columns?
how to Update table Sales_summary with max(sales) data from table sales_dataTable 1. sales_data table Table 2. Sales_summary Region sales Region sales N 500 N 0 N 800 W 0 N 600 W 899 W 458 W 900 I want the Sales_summary After Update like this Region Sales N 800 W 900
What is the difference between local and global temporary table?
Which table is left in left join?
what is the difference between to_char and to_date functions?
How do I kill a query in postgresql?
how to select alphabets in a one column , for this the table name is PA_TASKS and column name is TASK_NUMBER, In TASK_NUMBER the data like this 1.1.3NN,1.1.4NN,1.5.1NN,1.3.2NE,1.5NN,1NN,1.2NE,1CE , For this i need to disply output as NN,NN,NN,NE,NN,NN,NE,CE, Its some urgent requirement ,thanks in advance