How to display duplicate rows in a table?

Select * from emp where deptno=any
(select deptno from emp having count(deptno)>1 group by deptno);

Showing Answers 1 - 19 of 19 Answers

Sachin

  • Aug 3rd, 2006
 

select * from emp

group by (empid)

having count(empid)>1

  Was this answer useful?  Yes

yakhubpasha

  • Aug 12th, 2006
 

empidempnameempsal
1yakhub20000
1yakhub20000
2pasha10000

    if the table is like this

         

         Delete from emp where

         Rowid not in (select min(rowid) from emp

        Groupby (empid,empname,empsal));

  Was this answer useful?  Yes

susindharan

  • Aug 24th, 2006
 

select distinct empid,empname,empsal from emp;

  Was this answer useful?  Yes

Sudeep Biswas

  • Nov 8th, 2006
 

One more way to find out dupl. rows in a table (t_empolyee in this case) is:

-------------------------------

select emp_id, desg
 from t_employee t1
 where
( select count(*)
 from employee t2
where t2.emp_id = t1.emp_id) > 1

---------------------------------

  Was this answer useful?  Yes

Vijay Akumalla

  • Dec 13th, 2006
 

Dear All, Let us use this space to answer questions correctly, instead of guess work. This website should be used to gain knowledge in the correct direction.

  Was this answer useful?  Yes

Nandu

  • Feb 22nd, 2007
 

select * from tablename t1 where 1<(select * from tablename t2 where t1.col1=t2.col1);

  Was this answer useful?  Yes

ashwani7jul

  • Jan 20th, 2010
 

DELETE FROM test

USING test, test AS vtable

WHERE (test.ID > vtable.ID)

AND (test.name=vtable.name)

Deleted duplicate records  query

 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions