【问题标题】:How to solve The multi-part identifier "r.StandardRate" could not be bound如何解决无法绑定多部分标识符“r.StandardRate”
【发布时间】:2016-07-12 11:45:42
【问题描述】:

对于如下所示的查询,我收到以下错误:

消息 4104,第 16 级,状态 1,第 37 行
无法绑定多部分标识符“r.ResourceId”。

消息 4104,第 16 级,状态 1,第 16 行
无法绑定多部分标识符“r.StandardRate”。

你能帮我解决这个问题吗?

查询:

select               
    vnd.Name as VendorName, 
    cct.Name as CostCentreName, 
    ct.Name as CostType,
    case when cct.IsActive = 1 then 'ACTIVE' else 'CLOSED' end as CCStatus, 
    isnull(cct.T1Code,'') as T1Code,
    cct.T2Code,  
    '' as [Month], 
    convert(varchar, year(pf.period)) + '-' + convert(varchar, month(pf.period)) as Period,
    pp.ParentProformaNo,
    pf.ProformaNo,  
    vac.TrafiguraAccountCode,
    vac.PumaAccountCode,
    pli.FinalAmt as Ammount, 
    ts.Quantity as Quantity,
    r.StandardRate as StandardRate,
    cmp.[Text] as ProformaStatus,
    '' as BillableUOM, 
    '' as Currency,
    bet.Entity as CCBilledEntity,
    bcet.Name as CCBilledCompany,
    pbet.Entity as ProformaBilledEntity, 
    pbcet.Name as ProformaBilledCompany
from 
    ProformaParent pp
join 
    Proforma pf on pf.ProformaParentId = pp.Id
join 
    ProformaCostCentre pcc on pcc.ProformaId = pf.ProformaId
join 
    CostCentre cct on cct.Id = pcc.CostCentreId
join 
    ProformaLineItems pli on pli.ProformaId = pcc.ProformaId 
                          and pli.ProformaCostCentreId = pcc.ProformaCostCentreId
join 
    Vendor vnd on vnd.Id = pf.VendorId
join 
    CostType ct on ct.Id = pli.CostTypeId
join 
    VendorAccountCode vac on vac.VendorMId = vnd.Id 
                          and vac.CostTypeMId = ct.Id
join 
    CodeMaster cmp on cmp.Id = pf.StatusId
join 
    BilledEntity bet on bet.Id = cct.BilledEntityMId
join 
    Entity bcet on bcet.Id = cct.BilledCompanyEntityId
join 
    BilledEntity pbet on pbet.Id = pf.BilledEntityId
join 
    Entity pbcet on pbcet.Id = pf.BilledCompanyId
join 
    TimeSheet ts on ts.ResourceId = r.ResourceId

【问题讨论】:

  • 您的查询看起来像 SQL Server。一般而言,在提出问题时,您应该使用您正在使用的数据库标记问题。
  • 您尚未加入任何别名为r 的表。也许您忘记加入所需的表,或者使用了错误的别名?

标签: sql sql-server


【解决方案1】:

您的查询中根本没有名为 r 的对象。

【讨论】:

    猜你喜欢
    • 2011-10-12
    • 2011-11-10
    • 2010-11-02
    • 2023-03-21
    相关资源
    最近更新 更多