SQL Server 2014 sql mulitpart identifier cannot be bound -


i'm still neophyte when comes sql server. so, can direct me in why i'm getting following error:

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

this script:

select      orderitem.orderid     , orderitem.orderitemid     , orderitem.did     , cset.nnumber     , orderitem.amount     , orderitem.quantity     , orderitem.quantity     , csetorder.csetorderid     , cset.csetid     , cset.required      cset inner join      orderitem on orderitem.orderitemid = claimsetorder.orderitemid inner join      csetorder on csetorder.csetid = cset.csetid      orderitem.oid = xxxx 

you need specify table before using in on clause. so, rearrange order of conditions in from:

from claimset inner join      claimsetorder      on claimsetorder.claimsetid = claimset.claimsetid inner join      orderlineitem      on orderlineitem.orderlineitemid = claimsetorder.orderlineitemid  

note: recommend use table aliases simplify query construction:

from claimset cs inner join      claimsetorder cso      on cso.claimsetid = cs.claimsetid inner join      orderlineitem oli      on oli.orderlineitemid = cso.orderlineitemid  

this requires changing column references throughout query.


Comments