Created
February 22, 2011 18:23
-
-
Save finsterthecat/839106 to your computer and use it in GitHub Desktop.
Fix duplicates. Useful for when you want to add an alternate key to fields that currently have dups.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| update searchable s1 | |
| set datasource_guid = datasource_guid || ' @@DUPLICATE@@ ' || searchable_id, | |
| published_flag = 'N' | |
| where s1.searchable_id > | |
| ( | |
| select min(s2.searchable_id) | |
| from searchable s2 | |
| where s1.datasource_id = s2.datasource_id | |
| and s1.datasource_guid = s2.datasource_guid | |
| ); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Somewhat inspired by http://www.adp-gmbh.ch/ora/sql/delete_dups.html . But not as good.