Reputation: 3
I am receiving the error 'Ambiguous column name 'ClaimID' for the following:
USE ERSBI_Claims_Warehouse
GO
SELECT
ClaimID AS vClaimID,
DevelopmentTimeID AS vDevelopmentTimeID,
UnderwritingYear AS vUnderwritingYear,
IncurredClaimCount AS vIncurredClaimCount,
PaidClaimCount AS vPaidClaimCount,
EstimateClaimCount AS vEstimateClaimCount
FROM
FactClaimSnapshotbreakdownClaimCount as fcbscc
INNER JOIN ERSBI_Warehouse.dbo.FactClaimAccidentYear AS fcay
ON fcbscc.ClaimID = fcay.ClaimID
WHERE
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
Upvotes: 0
Views: 390
Reputation: 16917
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
or
SELECT fcay.ClaimID
will suffice
Upvotes: 1
Reputation: 204924
Since ClaimID
exists in both tables you need to name from which you want to select:
SELECT fcbscc.ClaimID ...
Upvotes: 6