我设法识别来自两个不同数据库的重复记录:
select * from
taskperformance a, taskperformance@dm_prod b
where
a.activityin = b.activityin
and a.completiondate = b.completiondate
如何从b
删除重复记录?
我试过了:
delete taskperformance@dm_prod where exist (
select * from
taskperformance a, taskperformance@dm_prod b
where
a.activityin = b.activityin
and a.completiondate = b.completiondate )
但它删除的内容超出了我的需要。
答案 0 :(得分:2)
您不应该在子查询中重新引用b
:
delete taskperformance@dm_prod b
where exists (
select * from taskperformance a
where a.activityin = b.activityin
and a.completiondate = b.completiondate
)