- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use a subquery within a left join and I am getting this error.
ERROR: ORACLE prepare error: ORA-00905: missing keyword. SQL statement: select WDM_HSBSB_SUBSC.SBSB_ID as CARD_HLDR_ID_NUM,
WDM_HMEME_MEMBER.MEME_FIRST_NAME || ' ' || WDM_HMEME_MEMBER.MEME_LAST_NAME as PATIENT_NAME, WDM_HMEME_MEMBER.MEME_BIRTH_DT
Here is a sample of my code
left join
( select
max (HIDCD_SK) as max_HIDCD_SK,
IDCD_DESC
from WDM_HIDCD_DIAG_CD
where max_HIDCD_SK = HIDCD_SK) as DIAG_DESC
on (WDM_DDIST_DIAG_SET.DDIST_IDCD_AD = DIAG_DESC.max_HIDCD_SK)
where
WDM_HSBSB_SUBSC.SBSB_ID in
('XXXXX')
and WDM_DFNIN_FUNDING_INFO.DFNIN_CLAIM_TYPE <> 'R' /* R = pharmacy */
and WFT_FCDML_CL_LINE.FCDML_RPT_PAID_DT <> WFT_FCDML_CL_LINE.FCDML_PROCESS_DT
and WDM_HCLCL_CLAIM.HCLCL_AS_OF_TO_DT = '31-Dec-9999'
and WDM_DCDBC_CL_LINE_BCN_CODES.DCDCD_DENIAL_IND = 'N'
What am I doing wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since you are not sharing the full code, I'm assuming your submitting this in a pass through block (...FROM CONNECTION TO...).
Everything within this block is totally agnostic for SAS, it's the responsibility for the target DBMS (Oracle). So reach out to your fellow Oracle users instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You are correct I am using a pass through. I will start searching oracle joins then.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
where max_HIDCD_SK = HIDCD_SK) as DIAG_DESC
on (WDM_DDIST_DIAG_SET.DDIST_IDCD_AD = DIAG_DESC.max_HIDCD_SK)
That first line doesn't look correct, you usually don't alias on WHERE conditions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Where does your subquery end? I don't see any closing bracket.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's there. I just didn't copy and paste it.