当前位置: 代码迷 >> Oracle面试 >> update from 的有关问题
  详细解决方案

update from 的有关问题

热度:2834   发布时间:2013-02-26 00:00:00.0
update from 的问题
update CsoKPIBase a set F_ASPNodeTotalCsoQty = (select count(Key) as sum_qty, ASPNode from CsoKPIBase
  where 
  ServiceType<> 9 
  and ServiceType<> 11 
  and ServiceType<> 12 
  and  InternalCloseTime >= to_date('2012-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') 
  and InternalCloseTime <= to_date('2012-12-12 23:59:59', 'yyyy-mm-dd hh24:mi:ss') group by ASPNode)b
  where a.ASPNode=b.ASPNode

应该怎么改啊?我这样写报错,求高手指导

------解决方案--------------------------------------------------------

update CsoKPIBase a set F_ASPNodeTotalCsoQty = (select count(Key) as sum_qty from CsoKPIBase c
   where 
   c.ServiceType<> 9 
   and c.ServiceType<> 11 
   and c.ServiceType<> 12 
   and  c.InternalCloseTime >= to_date('2012-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') 
   and c.InternalCloseTime <= to_date('2012-12-12 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
   and c.ASPNode=a.ASPNode
   group by ASPNode   
   )b 

要是CsoKPIBase 查不到a.ASPNode 会 更新成空值的哦
  相关解决方案