请大家帮我看下下面这条SQL,我将两张表关联后修改,有问题吗,是我的写法本来行不通,还是语法问题??
update MOCTA set MOCTA.TA009='200908' and MOCTA.TA010='200907' and MOCTB.TB015='200908'
from MOCTB INNER JOIN MOCTA ON MOCTB.TB001=MOCTA.TA001 AND MOCTB.TB002=MOCTA.TA002
where MOCTA.TA011<>'Y' AND MOCTA.TA011<>'y' and MOCTA.TA033<>'' and MOCTA.TA033='00036-1'
update MOCTA set MOCTA.TA009='200908' and MOCTA.TA010='200907' and MOCTB.TB015='200908'
from MOCTB INNER JOIN MOCTA ON MOCTB.TB001=MOCTA.TA001 AND MOCTB.TB002=MOCTA.TA002
where MOCTA.TA011<>'Y' AND MOCTA.TA011<>'y' and MOCTA.TA033<>'' and MOCTA.TA033='00036-1'
from MOCTB INNER JOIN MOCTA ON MOCTB.TB001=MOCTA.TA001 AND MOCTB.TB002=MOCTA.TA002
where MOCTA.TA011 <>'Y' AND MOCTA.TA011 <>'y' and MOCTA.TA033 <>'' and MOCTA.TA033='00036-1'
AND-->,
要用SET
A = 1,
B = 2,
C = 3
set
MOCTA.TA009='200908' ,MOCTA.TA010='200907' , MOCTB.TB015='200908'
from
MOCTB INNER JOIN MOCTA ON MOCTB.TB001=MOCTA.TA001 AND MOCTB.TB002=MOCTA.TA002
where
MOCTA.TA011 <>'Y' AND MOCTA.TA011 <>'y' and MOCTA.TA033 <>'' and MOCTA.TA033='00036-1'
set a.TA009='200908',
a.TA010='200907'
--and MOCTB.TB015='200908'
from MOCTB b INNER JOIN MOCTA a
ON b.TB001=a.TA001
AND b.TB002=a.TA002
where a.TA011 <>'Y'
AND a.TA011 <>'y'
and a.TA033 <>''
and a.TA033='00036-1'
update MOCTA set MOCTA.TA009='200908',MOCTA.TA010='200907',MOCTB.TB015='200908'
from MOCTB INNER JOIN MOCTA ON MOCTB.TB001=MOCTA.TA001 AND MOCTB.TB002=MOCTA.TA002
where MOCTA.TA011<>'Y' AND MOCTA.TA011<>'y' and MOCTA.TA033='00036-1'提示:无法使用列前缀 'MOCTB'。此前缀必须与 UPDATE 子句 'MOCTA' 中的对象匹配。