카테고리 없음

[SQL] MS Access SQL 다중 JOIN 및 WHERE 절

행복을전해요 2021. 2. 5. 11:40

SQL 쿼리에는 where절이 하나만 있습니다. 다음 조건을 조건의 일부로 변경해야 on합니다.

FROM ( ( ( ( ( ( [Claims]  
LEFT JOIN [BillType] ON [Claims].[Bill_Type] = [BillType].[BillType_Bill Type Key] )  
LEFT JOIN [PlaceofService] ON [Claims].[Place_of_Service] = [PlaceofService].[POS_Place of Service] )  
LEFT JOIN [Participating] ON [Claims].[TIN] = [Participating].[TIN] )  
LEFT JOIN [NYS Medicaid Fee Schedule Apr11] ON [Claims].[FivedigitProcCode] = [NYS Medicaid Fee Schedule Apr11].[Apr11_NYS_CODE] )  
LEFT JOIN [NYS Medicaid Fee Schedule Jan12] ON [Claims].[FivedigitProcCode] = [NYS Medicaid Fee Schedule Jan12].[Jan12_NYS_CODE]  
  AND [Claims].[BeginningDOS] BETWEEN [NYS Medicaid Fee Schedule Jan12].[Jan12_NYS_EFFECTIVE DATE] AND [NYS Medicaid Fee Schedule Jan12].[Jan12_NYS_END DATE] )  
  LEFT JOIN [NYS Medicaid Fee Schedule Apr13] ON [Claims].[FivedigitProcCode] = [NYS Medicaid Fee Schedule Apr13].[Apr13_NYS_CODE]    
    AND [Claims].[BeginningDOS] BETWEEN [NYS Medicaid Fee Schedule Apr13].[Apr13_NYS_EFFECTIVE DATE] AND [NYS Medicaid Fee Schedule Apr13].[Apr13_NYS_END DATE] )  
    LEFT JOIN [NY Medicare] ON [Claims].[FivedigitProcCode] = [NY Medicare].[MEDICARE_HCPCS CODE]  
      AND [Claims].[Zone] = [NY Medicare].[MEDICARE_ZONE]  
      


출처
https://stackoverflow.com/questions/22050127