これは答えが不可能かもしれませんが、私は最高のものを望んでいます。私は専門家から遠く、私の前身からこの質問を引き継いだ。私はこのエラーをLENGTHで調べましたが、何が欠けているのか分かりません。複数部分の識別子「C.C_CRNT_STAT_CD」をバインドできませんでした
元のクエリからの各変更の後ろに*********を追加しました。私は、以下のクエリoをフィールドC.C_CRNT_STAT_CD t
を追加しようと、私は非常に任意の助けに感謝し、事前にあなたをとても感謝します
error: Lookup Error - SQL Server Database Error: The multi-part identifier "C.C_CRNT_STAT_CD" could not be bound.
を受けています。
SELECT DISTINCT
zSTANCSPED1.CSPED_LAST_NM,
zSTANCSPED1.CSPED_FIRST_NM,
zSTANCSPED1.CSPED_MIDDLE_NM,
zSTANCSPED1.CSPED_SSN,
zSTANCSPED1.CSPED_DOB,
zSTANCSPED1.CSPED_STUDY_ID,
zSTANCSPED1.CSPED_RA_DATE,
zSTANCSPED1.P_CSE_EXTID,
zSTANCSPED1.C_CASE_EXTID,
zSTANCSPED1.CC_COURT_CASE_EXTID,
SUP.S_ACTV_NM_CD,
SUP.S_TYPE_CD,
SUP.S_SUPR_LVL,
C.C_CRNT_STAT_CD,******************
CASE WHEN (SUP.S_STRT_TS LIKE '%1900%') OR (SUP.S_STRT_TS LIKE '%1901%')
THEN NULL
ELSE CONVERT(DATETIME, SUP.S_STRT_TS, 108)
END AS 'S_STRT_TS',
CASE WHEN (SUP.S_END_TS LIKE '%1900%') OR (SUP.S_END_TS LIKE '%1901%')
THEN NULL
ELSE CONVERT(DATETIME, SUP.S_END_TS, 108)
END AS 'S_END_TS',
SUP.S_SUPR_DESC
FROM
(SELECT * FROM zSTANCSPED
LEFT JOIN (SELECT PD.P_PRTCP_ID,PD.SSN_SOC_SECURE_NUM,PD.P_CSE_EXTID,
PD.BI_BIRTH_DT
FROM PARTICIPANT_DEMOGRAPHIC PD) PD
ON zSTANCSPED.CSPED_SSN = PD.SSN_SOC_SECURE_NUM
AND zSTANCSPED.CSPED_DOB = PD.BI_BIRTH_DT
LEFT JOIN (SELECT CP.CP_PRTCP_ID,CP.CP_CASE_ID,CP.CP_ROLE_CD
FROM CASE_PARTICIPANT CP
WHERE CP.CP_STAT_CD <> 'OBS') CP
ON CP.CP_PRTCP_ID = PD.P_PRTCP_ID
LEFT JOIN (SELECT C.MTH_YR,C.CAS_CASE_ACCT_SUM_ID,C.C_CASE_ID,C.C_CASE_EXTID,C.C_MNG_CNTY_FIPS_CD,C.C_CRNT_STAT_CD*************
FROM CASE_CAS C
WHERE (C.C_CRNT_STAT_CD <> 'obs')) C
ON CP.CP_CASE_ID = C.C_CASE_ID
LEFT JOIN (SELECT CCC.CCC_CASE_ID,CC.CC_COURT_CASE_EXTID,
LA.LA_FILE_DT,LA.SO_HLTH_INSURE_ORDR_CD, CC_COURT_CASE_ID,LA_COURT_CASE_ID,LA.LA_LEGL_ACTV_ID
FROM CASE_COURT_CASE CCC
JOIN COURT_CASE AS CC
ON CC.CC_COURT_CASE_ID =
CCC.CCC_COURT_CASE_ID
JOIN LEGAL_ACTIVITY AS LA
ON LA.LA_COURT_CASE_ID =
CC.CC_COURT_CASE_ID AND LA.LA_LGL_ACTV_TYPE_CD = 'SUP'
AND LA.LA_STAT_CD = 'ACT'
) AS LA
ON LA.CCC_CASE_ID = C.C_CASE_ID) zSTANCSPED1
JOIN SUPPRESSION SUP
ON zSTANCSPED1.CP_PRTCP_ID = SUP.S_PRTCP_ID
UNION
SELECT DISTINCT
zSTANCSPED1.CSPED_LAST_NM,
zSTANCSPED1.CSPED_FIRST_NM,
zSTANCSPED1.CSPED_MIDDLE_NM,
zSTANCSPED1.CSPED_SSN,
zSTANCSPED1.CSPED_DOB,
zSTANCSPED1.CSPED_STUDY_ID,
zSTANCSPED1.CSPED_RA_DATE,
zSTANCSPED1.P_CSE_EXTID,
zSTANCSPED1.C_CASE_EXTID,
zSTANCSPED1.CC_COURT_CASE_EXTID,
SUP.S_ACTV_NM_CD,
SUP.S_TYPE_CD,
SUP.S_SUPR_LVL,
C.C_CRNT_STAT_CD,**************
CASE WHEN (SUP.S_STRT_TS LIKE '%1900%') OR (SUP.S_STRT_TS LIKE '%1901%')
THEN NULL
ELSE CONVERT(DATETIME, SUP.S_STRT_TS, 108)
END AS 'S_STRT_TS',
SUP.S_END_TS,
SUP.S_SUPR_DESC
FROM
(SELECT * FROM zSTANCSPED
LEFT JOIN (SELECT PD.P_PRTCP_ID,PD.SSN_SOC_SECURE_NUM,PD.P_CSE_EXTID,
PD.BI_BIRTH_DT
FROM PARTICIPANT_DEMOGRAPHIC PD) PD
ON zSTANCSPED.CSPED_SSN = PD.SSN_SOC_SECURE_NUM
AND zSTANCSPED.CSPED_DOB = PD.BI_BIRTH_DT
LEFT JOIN (SELECT CP.CP_PRTCP_ID,CP.CP_CASE_ID,CP.CP_ROLE_CD
FROM CASE_PARTICIPANT CP
WHERE CP.CP_STAT_CD <> 'OBS') CP
ON CP.CP_PRTCP_ID = PD.P_PRTCP_ID
LEFT JOIN (SELECT C.MTH_YR,C.CAS_CASE_ACCT_SUM_ID,C.C_CASE_ID,C.C_CASE_EXTID,C.C_MNG_CNTY_FIPS_CD,C.C_CRNT_STAT_CD**************
FROM CASE_CAS C
WHERE (C.C_CRNT_STAT_CD <> 'obs')) C
ON CP.CP_CASE_ID = C.C_CASE_ID
LEFT JOIN (SELECT CCC.CCC_CASE_ID,CC.CC_COURT_CASE_EXTID,
LA.LA_FILE_DT,LA.SO_HLTH_INSURE_ORDR_CD, CC_COURT_CASE_ID,LA_COURT_CASE_ID,LA.LA_LEGL_ACTV_ID
FROM CASE_COURT_CASE CCC
JOIN COURT_CASE AS CC
ON CC.CC_COURT_CASE_ID =
CCC.CCC_COURT_CASE_ID
JOIN LEGAL_ACTIVITY AS LA
ON LA.LA_COURT_CASE_ID =
CC.CC_COURT_CASE_ID AND LA.LA_LGL_ACTV_TYPE_CD = 'SUP'
AND LA.LA_STAT_CD = 'ACT'
) AS LA
ON LA.CCC_CASE_ID = C.C_CASE_ID) zSTANCSPED1
JOIN SUPPRESSION SUP
ON zSTANCSPED1.C_CASE_ID = SUP.S_CASE_ID
UNION
SELECT DISTINCT
zSTANCSPED1.CSPED_LAST_NM,
zSTANCSPED1.CSPED_FIRST_NM,
zSTANCSPED1.CSPED_MIDDLE_NM,
zSTANCSPED1.CSPED_SSN,
zSTANCSPED1.CSPED_DOB,
zSTANCSPED1.CSPED_STUDY_ID,
zSTANCSPED1.CSPED_RA_DATE,
zSTANCSPED1.P_CSE_EXTID,
zSTANCSPED1.C_CASE_EXTID,
zSTANCSPED1.CC_COURT_CASE_EXTID,
SUP.S_ACTV_NM_CD,
SUP.S_TYPE_CD,
SUP.S_SUPR_LVL,
C.C_CRNT_STAT_CD,***************
CASE WHEN (SUP.S_STRT_TS LIKE '%1900%') OR (SUP.S_STRT_TS LIKE '%1901%')
THEN NULL
ELSE CONVERT(DATETIME, SUP.S_STRT_TS, 108)
END AS 'S_STRT_TS',
SUP.S_END_TS,
SUP.S_SUPR_DESC
FROM
(SELECT * FROM zSTANCSPED
LEFT JOIN (SELECT PD.P_PRTCP_ID,PD.SSN_SOC_SECURE_NUM,PD.P_CSE_EXTID,
PD.BI_BIRTH_DT
FROM PARTICIPANT_DEMOGRAPHIC PD) PD
ON zSTANCSPED.CSPED_SSN = PD.SSN_SOC_SECURE_NUM
AND zSTANCSPED.CSPED_DOB = PD.BI_BIRTH_DT
LEFT JOIN (SELECT CP.CP_PRTCP_ID,CP.CP_CASE_ID,CP.CP_ROLE_CD
FROM CASE_PARTICIPANT CP
WHERE CP.CP_STAT_CD <> 'OBS') CP
ON CP.CP_PRTCP_ID = PD.P_PRTCP_ID
LEFT JOIN (SELECT C.MTH_YR,C.CAS_CASE_ACCT_SUM_ID,C.C_CASE_ID,C.C_CASE_EXTID,C.C_MNG_CNTY_FIPS_CD,C.C_CRNT_STAT_CD*************
FROM CASE_CAS C
WHERE (C.C_CRNT_STAT_CD <> 'obs')) C
ON CP.CP_CASE_ID = C.C_CASE_ID
LEFT JOIN (SELECT CCC.CCC_CASE_ID,CC.CC_COURT_CASE_EXTID,
LA.LA_FILE_DT,LA.SO_HLTH_INSURE_ORDR_CD, CC_COURT_CASE_ID,LA_COURT_CASE_ID,LA.LA_LEGL_ACTV_ID
FROM CASE_COURT_CASE CCC
JOIN COURT_CASE AS CC
ON CC.CC_COURT_CASE_ID =
CCC.CCC_COURT_CASE_ID
JOIN LEGAL_ACTIVITY AS LA
ON LA.LA_COURT_CASE_ID =
CC.CC_COURT_CASE_ID AND LA.LA_LGL_ACTV_TYPE_CD = 'SUP'
AND LA.LA_STAT_CD = 'ACT'
) AS LA
ON LA.CCC_CASE_ID = C.C_CASE_ID) zSTANCSPED1
JOIN SUPPRESSION SUP
ON zSTANCSPED1.LA_COURT_CASE_ID = SUP.S_COURT_CASE_ID
CASE_CASテーブルにC_CRNT_STAT_CD列があることを確認するだけですか? – Sam
この内部クエリを実行できますか?SELECT C.MTH_YR、C.CAS_CASE_ACCT_SUM_ID、C.C_CASE_ID、C.C_CASE_EXTID、C.C_MNG_CNTY_FIPS_CD、C.C_CRNT_STAT_CD ************ FROM CASE_CAS C WHERE(C.C_CRNT_STAT_CD <> 'obs') '?追加したカラムが 'CASE_CAS'テーブルに存在していることを確認したいだけです。 – Eric