基本上是在寻找一种方法,将已填充错误数据的表与具有“修复”它的好数据的表合并,但我想要的好数据中有相当多的重复数据,我需要 GROUP 以便我可以有一些可以匹配的东西。
所以在这种情况下简化了:
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
因此,在此示例中,我尝试使用 Series Record 表中的 SERIES_ID 更新 Customer Records 表中的 SERIES_ID。我有我可以匹配的标题。
我尝试如下:
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;
但是,当我这样做时,我得到:
`A stable set of rows could not be got because of large dml activity or a non-deterministic where clause`
任何想法?