Basically looking at a way to merge a table that has been filled with erroneous data with a table that has good data to "repair" it but the good data I want has quite a bit of repetitious data in it that I need to GROUP so that I can have something to match on.
So in this case simplified down:
Customer_Records - Bad Data in SERIES_ID
| TITLE | SERIES_ID | TYPE |
| EX1 | 00000 | 1 |
| EX2 | 00009 | 1 |
| EX3 | 01234 | 2 |
Series_Records - Good data
| TITLE | SERIES_ID | SUBSERIES_ID |
| EX1 | 98555 | 00001
| EX1 | 98555 | 00002
| EX2 | 98764 | 00098
| EX2 | 98764 | 00108
So in this example I am trying to update the SERIES_ID in the Customer Records table with the SERIES_ID in the Series Record table. I have the Title that i can match on.
What I tried is as follows:
merge into CUSTOMER_RECORDS CR
using (select TITLE, SERIES_ID from SERIES_RECORDS GROUP BY TITLE, SERIES_ID) SR
on (CR.TITLE = SR.TITLE)
when matched then
update set CR.SERIES_ID = SR.SERIES_ID;
When I do this however I get a:
`A stable set of rows could not be got because of large dml activity or a non-deterministic where clause`
Any idea?