テーブル内のレコード セットを、同じテーブル内の別のレコード セットの値で更新しようとしています。このクエリを実行すると、次のエラーが発生します。
メッセージ 4104、レベル 16、状態 1、行 1
マルチパート識別子「t.com」をバインドできませんでした。
コード:
update tphase
set
t.com = t.com + b.com,
t.direct = t.direct + b.direct,
t.fee = t.fee + b.fee,
t.fringe = t.fringe + b.fringe,
t.fte = t.fte + b.fte,
t.ganda = t.ganda + b.ganda,
t.hours = t.hours + b.hours,
t.overhead = t.overhead + b.overhead,
t.fccmga = t.fccmga + b.fccmga,
t.fccmoh = t.fccmoh + b.fccmoh,
t.lbroh = t.lbroh + b.lbroh,
t.ms = t.ms + b.ms
from
tphase t
inner join
(select *
from tphase
where program = 'xenon' and
class = 'earned' and
df_date > '2013-05-03'
) as b on t.program = b.program and
t.cawpid = b.cawpid and
t.class = b.class and
t.cecode = b.cecode
where
t.program = 'xenon' and
t.class = 'earned' and
t.df_date = '2013-05-03' ;