こんにちは、1列の条件があり、次のようになります
select
WHEN NM1.nm101 = 'IL' THEN ( CLP.Segment_GUID as CLPSegmentGuid,
NM1.NM102 as [INSURED_Entity_Type_Qualifier],
NM1.NM103 as [INSURED_Entity_Last_Name],
NM1.NM104 as [INSURED_Entity_First_Name],
NM1.NM105 as [INSURED_Entity_Middle_Name],
NM1.NM108 as [INSURED_Entity_Identification_Code_Type],
NM1.NM109 as [INSURED_Entity_Identification_Code])
WHEN NM1.nm101 = '74' THEN ( CLP.Segment_GUID as CLPSegmentGuid,
NM1.NM102 as [Corrected_Entity_Type_Qualifier],
NM1.NM103 as [Corrected_Entity_Last_Name],
NM1.NM104 as [Corrected_Entity_First_Name],
NM1.NM105 as [Corrected_Entity_Middle_Name],
NM1.NM108 as [Corrected_Entity_Identification_Code_Type],
NM1.NM109 as [Corrected_Entity_Identification_Code])
ELSE NM1.nm101 = '82' THEN ( CLP.Segment_GUID as CLPSegmentGuid,
NM1.NM102 as [CROSSOVER_Entity_Type_Qualifier],
NM1.NM103 as [CROSSOVER_Entity_Last_Name],
NM1.NM104 as [CROSSOVER_Entity_First_Name],
NM1.NM105 as [CROSSOVER_Entity_Middle_Name],
NM1.NM108 as [CROSSOVER_Entity_Identification_Code_Type],
NM1.NM109 as [CROSSOVER_Entity_Identification_Code])
From X12_NM1 NM1
Inner Join X12_CLP CLP
ON CLP.segment_guid = NM1.parent_segment_guid
そのため、その特定の列 NM101 に対して select ステートメントを実行しているときに、条件を確認して列を返す必要があります。