MouseHunger MouseHunger - 1 year ago 111
SQL Question

Ambiguous column name error SQL

I am receiving the error 'Ambiguous column name 'ClaimID' for the following:

USE ERSBI_Claims_Warehouse

ClaimID AS vClaimID,
DevelopmentTimeID AS vDevelopmentTimeID,
UnderwritingYear AS vUnderwritingYear,
IncurredClaimCount AS vIncurredClaimCount,
PaidClaimCount AS vPaidClaimCount,
EstimateClaimCount AS vEstimateClaimCount

FactClaimSnapshotbreakdownClaimCount as fcbscc

INNER JOIN ERSBI_Warehouse.dbo.FactClaimAccidentYear AS fcay
ON fcbscc.ClaimID = fcay.ClaimID

fcbscc.BreakdownIntermediateLevel = 'TPP'
AND UnderwritingYear > 2013

I am very new to SQL however I think I have included all of the relevant table names. Can someone please tell me where I am going wrong? Thank you in advance

Answer Source

You are selecting just ClaimId in your SELECT statement, but you have multiple tables with ClaimId in it.

You need to tell it which table you're pulling from.

Based on your join:

fcbscc.ClaimID = fcay.ClaimID

Doing either

SELECT fcbscc.ClaimID 


SELECT fcay.ClaimID

will suffice

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download