error: expecting ON keyword between sgsg_ck and where. please help me

General

error: expecting ON keyword between sgsg_ck and where. please help me

INNER  JOIN 

(

SELECT 

SGSG_CK,

SGSG_ID

FROM ODS_PRD_STG_VW.CMC_SGSG_SUB_GROUP_STG

WHERE SGSG_ID ='H001'

)  SSG ON MPE.SGSG_CK=SSG.SGSG_CK  WHERE MMS.GRGR_CK='$$GRGR_CK'

1 REPLY
Junior Contributor

Re: error: expecting ON keyword between sgsg_ck and where. please help me

Simply remove the parens around the join condition:

INNER  JOIN 
(
SELECT
SGSG_CK,
SGSG_ID
FROM ODS_PRD_STG_VW.CMC_SGSG_SUB_GROUP_STG
WHERE SGSG_ID ='H001'
) SSG
ON MPE.SGSG_CK=SSG.SGSG_CK
WHERE MMS.GRGR_CK=$$GRGR_CK