1

我设法识别来自两个不同数据库的重复记录:

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 ) 

但它删除的内容超出了我的需要。

4

1 回答 1

2

b您不应该在子查询中重新引用:

delete taskperformance@dm_prod b
where exists (
    select * from taskperformance a
    where a.activityin = b.activityin 
    and a.completiondate = b.completiondate 
)
于 2009-08-27T01:25:02.543 回答