我正在尝试将配置单元中的两个表连接到多列上。我想连接的列之一是,我正在处理一些数据以匹配另一个表中的结构,然后我计划连接它。
我的挑战是,我正在创建的专栏不允许我加入。我尝试了几种不同的方法,但到目前为止我都没有成功。感谢您的帮助!
SELECT
prvdr_num,
CONCAT(SUBSTR(CLM_ADMSN_DT, 5, 2),"/",SUBSTR(CLM_ADMSN_DT, 7,
2),"/",SUBSTR(CLM_ADMSN_DT, 1, 4)) as Calendar_Admit_date,
AdmitDate,
CMSId
FROM table1
INNER JOIN table2
ON table1.CMSId = table2_lds.prvdr_num
AND table1.AdmitDate =
table2.CONCAT(SUBSTR(CLM_ADMSN_DT, 5, 2),"/",SUBSTR(CLM_ADMSN_DT, 7,
2),"/",SUBSTR(CLM_ADMSN_DT, 1, 4))
我也尝试过这个,但它不会起作用。
SELECT
prvdr_num,
CONCAT(SUBSTR(CLM_ADMSN_DT, 5, 2),"/",SUBSTR(CLM_ADMSN_DT, 7,
2),"/",SUBSTR(CLM_ADMSN_DT, 1, 4)) as Calendar_Admit_date,
AdmitDate,
CMSId
FROM table1
INNER JOIN table2
ON table1.CMSId = table2_lds.prvdr_num
AND table1.AdmitDate =
table2.Calendar_Admit_date