How to delete same emp id in sql query for exmaple in emp
table emp id, empname, emp address. for example emp id =5,
repeated in two times in rows same id how to delete same
empid please any one of the write query send in my id
Answers were Sorted based on User's Feedback
Answer / akshita
delete from emp where rowid not in (select max(rowid) from
emp group by empno)
Is This Answer Correct ? | 11 Yes | 2 No |
Answer / mail2sentha
DELETE FROM EMP WHERE ROWID NOT IN(SELECT MIN(ROWID)FROM
EMP GROUP BY EMPID);
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / rohit kumar
Delete from employee where (empid,empname) notin (select min
(empid),empname from employee group by enmpname);
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / guest
u can delete by slelcting the rowid of that particular
record
Is This Answer Correct ? | 3 Yes | 4 No |
Answer / his highness yadav
ur question is not much clear
is it to delete duplicate rows or
to delete all the rows which is repeating , and the original
fr the first the query above will work fine
second option try this
delete from emp a, emp b where a.empno=b.empno
i think this will go ,, this will delete the all records which
is duplicating
cheers
Is This Answer Correct ? | 1 Yes | 4 No |
Answer / prajyot
Hi,
You can use the below mentioned query ....
SELECT ROWID( Emp_id ) FROM EMP WHERE Emp_id = 5;
Praj
Is This Answer Correct ? | 1 Yes | 5 No |
What is a subquery in sql?
If we update a complex view, is base table will get update ?
2 Answers Ardee Technologies, HCL,
What are string functions in sql?
what is the difference difference between procedure and packages
2 Answers 3i Infotech, Oracle,
what is d diff between grant,commit,rollback n savepoint
What is difference between stored procedure and trigger?
What is the difference between SQL Constraint and PL/SQL constraint.Pls give all the constraint name.
What are the types of join in sql?
how to convert character strings to numeric values? : Sql dba
What is sql integrity?
what are the different type of sql's statements ? : Sql dba
Are stored procedures faster than dynamic sql?