try:
update A set projmoney = 
(Select sum(Projmoney) from B where charindex(','+Projid +',' , ','+A.subProjid+',')>0)

解决方案 »

  1.   

    update A set Projmoney=(select sum(Projmoney) from b where a.subProjid like '%'+projid+'%')
      

  2.   

    update A set Projmoney=(select sum(Projmoney) from b where a.subProjid like '%'+projid+'%') where projmoney is null或:update A set Projmoney=(select sum(Projmoney) from b where ','+a.subProjid+',' like '%,'+projid+',%') where projmoney is null
      

  3.   

    或:update A set Projmoney=(select sum(Projmoney) from b where charindex(','+projid+',',','+a.subProjid+',')>0) where projmoney is null
      

  4.   

    to pengdali(大力 V3.0) :
      你好 .很感谢你的支持.可是我现在A表里没有哪个projmoney字段.怎么办?
      

  5.   

    select Projid,ProjName,subProjid,(select sum(Projmoney) from b where ','+a.subProjid+',' like '%,'+projid+',%') Projmoney from a
      

  6.   

    是SELECT 的,谢谢.正在试