gpt4 book ai didi

MYSQL错误代码: 1064 in the view

转载 作者:行者123 更新时间:2023-11-29 21:37:35 26 4
gpt4 key购买 nike

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT OUTER JOIN dw_fact_claim ON dw_fact_claim.patient_id = dw_snf.patient_id
' at line 13

我的查询是:

CREATE VIEW DW_SNF
AS
SELECT
REL ,
PATIENT_ID ,
MIN( CLM_FROM_DT )AS clm_from_dt ,
MAX( clm_THRU_dt )AS clm_THRU_dT
FROM dw_SNF
WHERE REL <> ''
GROUP BY
REL ,
PATIENT_ID
LEFT OUTER JOIN dw_fact_claim ON dw_fact_claim.patient_id = dw_snf.patient_id
AND dw_fact_claim.CLM_FROM_DT >= dw_SNF.clm_from_dt
AND dw_fact_claim.CLM_THRU_DT <= dw_SNF.clm_thru_dt
AND dw_fact_claim.TYPE_OF_CLAIM NOT LIKE '%snf%'
WHERE dw_SNF.rel <> ''
GROUP BY
rel ON SUMMARY.REL = SNF_BASE.REL
INNER JOIN dw_VIEW_dim_patient_FLAG AS DW_DIM_PATIENT ON dw_dim_patient.patient_id = dw_snf.patient_id
INNER JOIN DW_VIEW_JH_ACG_CONDENSED dw_jh_acg ON dw_jh_acg.patient_id = dw_dim_patient.patient_id
WHERE SNF_EPISODE_ID <> '';

最佳答案

我在左外连接之前使用了where子句,这是错误,在连接条件末尾使用where条件后我成功创建了 View 。我们不能在Group by子句中使用JOIN。

关于MYSQL错误代码: 1064 in the view,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34796601/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com