update tnhyb set yhs=(select cnt from (select hydm,count(*) cnt from tancalchis where yysname='大用户' and month='200411' group by hydm) t1 where tnhyb.tradecode=t1.hydm)
where exists (select 1 from (select hydm,count(*) cnt from tancalchis where yysname='大用户' and month='200411' group by hydm) t1 where tnhyb.tradecode=t1.hydm)

解决方案 »

  1.   

    上面表名拼错了update tnhyb set yhs=(select cnt from (select hydm,count(*) cnt from tncalchis where yysname='大用户' and month='200411' group by hydm) t1 where tnhyb.tradecode=t1.hydm)
    where exists (select 1 from (select hydm,count(*) cnt from tncalchis where yysname='大用户' and month='200411' group by hydm) t1 where tnhyb.tradecode=t1.hydm)
      

  2.   

    上面强人!
    不过也不知是什么原因,这条语句运行了足有两三分钟。数据库中也就不超过1万条记录。
    给咱讲讲update批量更新的绝技吧?!!!!
    期待ing!!!!!
    讲完再送80分;
      

  3.   

    我只是根据你的SQLSERVER的语句去改写的,至于效率要看你原来的语句以及你表中的索引情况等等来看。
      

  4.   

    批量更新没什么绝技,就是用update ... set ... where ...
      

  5.   

    语法不一样而已,既然你自己的sql7都写出来了,如果知道oracle语法,一样能写。
      

  6.   

    我查了一下资料,ORACLE的UPDATE没有FROM子句,如果要用就得写成子查询。
    谢谢大家了!