– KES的写法示例
UPDATE system.ACCURATE B
SET B.sid = T.sid,
FROM system.ACCURATE_res2 T , (SELECT COL_A ,
count(1)
FROM system.ACCURATE b
group by COL_A
having count(1) =1 ) c
WHERE B.COL_A = c.COL_A
and T.COL_A = B.COL_A;
– ORACLE的写法示例
UPDATE system.ACCURATE a
SET a.sid = (SELECT sid FROM system.ACCURATE_res2 b WHERE b.COL_A = a.COL_A)
WHERE EXISTS (select 1 from (SELECT COL_A ,
count(1)
FROM system.ACCURATE b
group by COL_A
having count(1) =1
)c
where c.COL_A = a.COL_A
);
备注:KES数据库的写法在ORACLE中运行不通过。