日期:2014-05-18  浏览次数:20445 次

出现表不明确
update   cardinfo   set   preamt=b.curamt   from   cardinfo   a   ,   cardinfo   b   where   a.cardid   =b.cardid   and   a.updatedate   = '2007-01-01 '   and   b.updatedate   =dateadd   (   dd   ,   -   1   ,   '2007-01-01 '   )     ;


------解决方案--------------------
update a --用别名
set
preamt=b.curamt
from
cardinfo a , cardinfo b
where
a.cardid =b.cardid
and
a.updatedate = '2007-01-01 '
and
b.updatedate =dateadd ( dd , - 1 , '2007-01-01 ' )