bj东方瑞通 Publish time 31-5-2012 14:17:13

Methods of querying duplicate data and deleting duplicate records in Oracle



For example, there is a personnel table (Table Name:peosons)
If you want to record the name, ID number and address of the three fields exactly the same,
select p1.*
from persons p1,persons p2
where p1.id<>p2.id
andp1.cardid = p2.cardid and p1.pname = p2.pname and p1.address = p2.address
use rowid Method can achieve the above effect.
According to oracle With rowid Property to determine whether there is repetition. The statement is as follows:
Check the data:
select * from table1 a where rowid !=(select max(rowid)
from table1 b where a.name1=b.name1 and a.name2=b.name2……)
Delete data:
deletefrom table1 a where rowid !=(select max(rowid)
from table1 b where a.name1=b.name1 and a.name2=b.name2……)

hjnn223 Publish time 2-4-2024 01:59:54

thanks for sharing this

丽姐 Publish time 21-4-2024 17:34:29

Many thanks

虚极静笃~郭贤 Publish time 25-6-2024 23:23:12

good job

360fans30221595 Publish time 26-6-2024 10:23:47

thank you

联兴农场(直销农 Publish time 1-8-2024 09:38:29

I need it, thanks

360fans53839379 Publish time 1-8-2024 11:57:35

thank you so much

A后石代~梁生 Publish time 1-8-2024 12:25:39

good material

欧振仪136696957 Publish time 9-8-2024 23:19:17

Thanks

yblossom Publish time 13-8-2024 22:56:01

good material
Pages: [1]
View full version: Methods of querying duplicate data and deleting duplicate records in Oracle