我需要创建一个提供商名称组,该组基于包含服务提供商代码的三个字段中的任何一个或全部。每个服务提供商代码链接到其自己的 SP_Program_Location 表以选择该提供商的提供商 ID,然后将其链接到提供商表以获得提供商名称。如果没有为客户分配提供者(所有三个提供者字段 = 0),则提供者分组应为“未分配提供者”,否则,提供者的名称需要包含在提供者组中。客户的提供者数量可以从 0 到 3 不等。一旦我对我的提供者公式进行分组,我就会丢失数据记录。我在一个位置分组,然后是提供者,然后是客户详细信息数据。
Program.provider1 ---->sp_Program_Location.SP_Program_Location_Codde--->sp_Program_location.Provider_ID ---> Provider.PROVIDER_ID
Program.provider2 ---->sp_Program_Location1.SP_Program_Location_Codde--->sp_Program_location1.Provider_ID ---> Provider1.PROVIDER_ID
Program.provider3 ---->sp_Program_Location2.SP_Program_Location_Codde--->sp_Program_location2.Provider_ID ---> Provider2.PROVIDER_ID