An item with the same key has already been added error

  • Can any one with fresh eyes tell me why I am getting this error. here is my query

    Select LVL1, LVL1DESC, LVL2, LVL2DESC, LVL3, LVL3DESC, PID, Code, PID,

    Identity_, AuditIndex, IsNull(LaborHours,0) as Hours,

    IsNull(TakeoffQty,0) as Qty, Y.[Description] as DESCR,IsDeleted

    FROM (

    SELECT DISTINCT SUBSTRING(L3.HierCode,1,1) as LVL1, L1.Name as LVL1DESC,

    SUBSTRING(L3.HierCode,1,2) as LVL2, L2.Name as LVL2DESC,

    L3.HierCode AS LVL3, L3.Name As LVL3DESC,

    RT.PID, RT.Code, RT.Description, L3.Identity_, L3.AuditIndex

    FROM RevisionTable RT INNER JOIN WBS9Table L3

    ON RT.PID = L3.RevisionID

    INNER JOIN WBS9Table L1 on

    SUBSTRING(L3.HierCode,1,1) = L1.HierCode

    INNER JOIN WBS9Table L2 on

    SUBSTRING(L3.HierCode,1,2) = L2.HierCode

    Where RT.Code=@Estimate

    And LEN(L3.HierCode)=3

    and LEN(L2.HierCode)=2

    and LEN(L1.HierCode)=1 ) X

    INNER JOIN

    (Select WBS9, TakeoffQty,IsDeleted, LaborHours,[Description] from [EDM].[dbo].[ItemTable]) Y

    on Y.WBS9 = X.AuditIndex Where Y.IsDeleted= N'false'

  • Never mind I found the problem. Had two keys of the same name

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply