0

テーブル内のレコード セットを、同じテーブル内の別のレコード セットの値で更新しようとしています。このクエリを実行すると、次のエラーが発生します。

メッセージ 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' ;
4

2 に答える 2

3

tphase にエイリアス t を指定する場合は、update ステートメントでもそのエイリアスを参照する必要があります。

UPDATE t
set
    t.com = t.com + b.com, 
...
于 2013-05-13T18:25:46.853 に答える
0

comこのエラーは、テーブルに指定された列がないことを示していtphaseます。その参照を削除するか、正しい列名に変更する必要があります。

于 2013-05-13T18:20:15.113 に答える