Author: bj东方瑞通

Methods of querying duplicate data and deleting duplicate records in Oracle

[Copy link]

0

Threads

0

Posts

0

Credits

Guest

Credits
0
Post time 5-31-2012 14:17:13 | Show all posts |Read mode


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
and  p1.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:
delete  from table1 a where rowid !=(select max(rowid)
from table1 b where a.name1=b.name1 and a.name2=b.name2……)
Reply

Use magic Report

0

Threads

3587

Posts

3581

Credits

L6-General

Rank: 8Rank: 8

Credits
3581
Post time 4-2-2024 01:59:54 | Show all posts
thanks for sharing this
Reply

Use magic Report

0

Threads

2634

Posts

2631

Credits

L5-Colonel

Rank: 6Rank: 6

Credits
2631
Post time 4-21-2024 17:34:29 | Show all posts
Many thanks
Reply

Use magic Report

0

Threads

2771

Posts

2768

Credits

L5-Colonel

Rank: 6Rank: 6

Credits
2768
Post time 6-25-2024 23:23:12 | Show all posts
good job
Reply

Use magic Report

0

Threads

3212

Posts

3202

Credits

L6-General

Rank: 8Rank: 8

Credits
3202
Post time 6-26-2024 10:23:47 | Show all posts
thank you
Reply

Use magic Report

0

Threads

2239

Posts

2238

Credits

L5-Colonel

Rank: 6Rank: 6

Credits
2238
Post time 8-1-2024 09:38:29 | Show all posts
I need it, thanks
Reply

Use magic Report

0

Threads

3102

Posts

3089

Credits

L6-General

Rank: 8Rank: 8

Credits
3089
Post time 8-1-2024 11:57:35 | Show all posts
thank you so much
Reply

Use magic Report

0

Threads

3079

Posts

3076

Credits

L6-General

Rank: 8Rank: 8

Credits
3076
Post time 8-1-2024 12:25:39 | Show all posts
good material
Reply

Use magic Report

0

Threads

3556

Posts

3546

Credits

L6-General

Rank: 8Rank: 8

Credits
3546
Post time 8-9-2024 23:19:17 | Show all posts
Thanks
Reply

Use magic Report

0

Threads

2520

Posts

2501

Credits

L5-Colonel

Rank: 6Rank: 6

Credits
2501
Post time 8-13-2024 22:56:01 | Show all posts
good material
Reply

Use magic Report

You have to log in before you can reply Login | Register Now

Points Rules

Quick Reply Contact us with Whastsapp Contact us with Teams Contact us with Telegram BBSDUMP X BBSDUMP facebook BBSDUMP YouTube BBSDUMP instagram To Top Return to the list