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 | 3 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 |
how to write utl file pkg in SQL
Why do we use sqlite?
what is the Default Libraries for Oracle Report 6i
Mention what are the benefits of pl/sql packages?
Is there a pl/sql pragma similar to deterministic, but for the scope of one single sql select?
Can you select everything, but 1 or 2 fields, without writer's cramp?
What is mutating sql table?
How many sql core licenses do I need?
what is difference between "Primary key" and "Unique key"?
How do I run a sql trace?
using cursors salesman get bonus as 10% of their salary , managers get 20% , analalist get 30%. generae a report showing the employee name, salary , bonus.
What is INSTEAD OF trigger ?
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)