我正在寻找 Sql Server 中的 Select 语句,我想要这样的东西
SELECT
st.segment_guid as ST_Segment_Guid,
ST.ST02 as [Transaction_Set_ControlNumber],
N1.N102 AS [Payer_Name],
N1.N104 AS [Payer_Identification_Number],
N1.N102 AS [Payee_Name],
N1.N104 END AS [Payee_Identification_Number],
FROM X12_ST ST
INNER JOIN X12_N1 N1 ON st.segment_guid = n1.parent_segment_guid
where ST.x12_interchange_guid = '3ff7d629-0036-4deb-bb69-31f8c159f71e'
如果N1.LoopID
是,'1000A'
那么它应该从付款人列中选择。如果N1.LoopID
是, '1000B'
那么它应该从收款人列中选择。
而对于 ST.x12_interchange_guid = '3ff7d629-0036-4deb-bb69-31f8c159f71e' 应该有一个付款人和一个收款人,我想要打扰付款人,收款人对于 ST.x12_interchange_guid 在单行中选择它时。