以下查询分两步执行更新:第一个查询更新那些存在和通过的测试,第二个查询更新那些存在和失败的测试。
update table1 t1
set t1.teststatus = 'pass'
where t1.testID in
(
select t2.testID
from table2 t2
group by t2.testID
having min(t2.status) = max(t2.status) and min(t2.status) = 'pass'
)
update table1 t1
set t1.teststatus = 'fail'
where t1.testID in
(
select t2.testID
from table2 t2
where t2.status = 'fail'
group by t2.testID
)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句