我试图更新我的表的寄存器,但是sql语句更新所有寄存器。
你能帮我解决一下代码吗?
merge into tableA k
using
( select p.host,
case count(p.nameJob) when 0 then '0'
else to_char(count(p.nameJob))
end count
from (
select distinct b.nameJob, a.host
from temp a
left join emuser.def_job b
on a.grpname in (b.node_id)
and b.application not like '@NOTINCLUDE'
) p
group by p.host ) ran
on (k.host=ran.host)
when matched then update set countjobsnodegroup = ran.count;
Select仅显示50个寄存器,但更新所有表寄存器(997)
select p.host,
case count(p.nameJob) when 0 then '0'
else to_char(count(p.nameJob))
end count
from (
select distinct b.nameJob, a.host
from proc_kk a
left join emuser.def_job b
on a.grpname in (b.node_id)
and b.application not like '@NOTINCLUDE'
) p
group by p.host;