
- Forum
- Database
- Oracle Database
- How to delete duplicate rows from a table
How to delete duplicate rows from a table
This is a discussion on How to delete duplicate rows from a table within the Oracle Database forums, part of the Database category; Hi friends, can any body please tell me how can i delete duplicate records from a table . If the ...
-
06-26-2005, 02:16 PM #1
- Join Date
- Jun 2005
- Answers
- 2
How to delete duplicate rows from a table
Hi friends,
can any body please tell me how can i delete duplicate records from a table .
If the table I have is with the following data
SNO SNAME
--------------------------------
1001 ATHER
1001 ATHER
1001 ATHER
1001 ATHER
1001 ATHER
is it possible to delete 4 records and keep any one record, plese reply if someone has answer.
Thanx& Regards
Ather
-
06-27-2005, 05:38 AM #2
- Join Date
- Jun 2005
- Answers
- 2
To delete Duplicate rows In a table
Hi Ather,
Assuming the table name as TEST with data in it as.
SNO SNAME
---- ---------
1001 ATHER
1001 ATHER
1001 ATHER
1001 ATHER
1001 ATHER
Query to delete duplicate records can be written as given below
SQL> delete from test a
where rowid <> ( select max(rowid)
from test b
where a.sno = b.sno
and a.sname = b.sname )
Hope it helps
Thnx&Regards
Kevin
-
08-25-2005, 03:28 AM #3
- Join Date
- Aug 2005
- Answers
- 3
delete duplicate record
delete from tablename e1 where rowid>(select min(rowid) from tablename e2
where e1.code=e2.code);
-
Deleting Duplicate records
Hi,
Try this out
SELECT sno,
COUNT(sno) AS NumOccurrences
FROM <tblname>
GROUP BY sno
HAVING ( COUNT(sno) > 1 )
Originally Posted by athermaliq
Hi friends,
can any body please tell me how can i delete duplicate records from a table .
If the table I have is with the following data
SNO SNAME
--------------------------------
1001 ATHER
1001 ATHER
1001 ATHER
1001 ATHER
1001 ATHER
is it possible to delete 4 records and keep any one record, plese reply if someone has answer.
Thanx& Regards
Ather
-
delete from test where rowid not in (select min(rowid) from test
group by sno sname);
-
01-17-2006, 12:03 AM #6
- Join Date
- Jan 2006
- Answers
- 1
how to delete duplicate rows from the following table
hi guys, i would like to know how to write a query to delete duplicate rows from the below table, friends reply me pls
KNO KNAME
---- -------
555 ssss
333 dddd
555 ssss
333 dddd
555 ssss
333 dddd
-
10-22-2011, 03:56 AM #7
i think we can't oit but we supress the duplicated date from which column u want by DISTINCT keyword.
-
Sponsored Ads

Reply With Quote





