Update with subquery get error: "The multi-part identifier could not be bound." (Sql Server 2008) -


i'm trying update set of records in table values set of records in same table. when run query, error:

msg 4104, level 16, state 1, line 1
multi-part identifier "t.com" not bound.

code:

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    tphase t  inner join    (select *     tphase     program = 'xenon' ,           class = 'earned' ,           df_date > '2013-05-03'            ) b on t.program = b.program ,              t.cawpid = b.cawpid ,              t.class = b.class ,              t.cecode = b.cecode    t.program = 'xenon' ,    t.class = 'earned' ,    t.df_date = '2013-05-03' ; 

if you're giving tphase alias t, need reference alias in update statement, too,

update t set     t.com = t.com + b.com,  ... 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -