我收到以下错误'不明确的列名'ClaimID':
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
我对SQL很新,但我认为我已经包含了所有相关的表名。有人可以告诉我哪里出错了吗?提前谢谢
答案 0 :(得分:6)
由于两个表中都存在ClaimID
,因此您需要从中选择名称:
SELECT fcbscc.ClaimID ...
答案 1 :(得分:1)
您只是在ClaimId
语句中选择SELECT
,但您有多个包含ClaimId
的表格。
你需要告诉它你从哪个桌子拉出来。
根据你的加入:
fcbscc.ClaimID = fcay.ClaimID
执行任何一项
SELECT fcbscc.ClaimID
或
SELECT fcay.ClaimID
就足够了