<Findings>
<Finding EcinRecordID="1042893">
<Name>Goal Length of Stay for the ORG</Name>
<Selected Value="0" DisplayValue="No"/>
</Finding>
<Finding EcinRecordID="1042894">
<Name>Goal Length of Stay for the GRG</Name>
<Selected Value="1" DisplayValue="Yes"/>
<NoteText>3 days</NoteText>
</Finding>
</Findings>
2個挑戰:調查結果基於兄弟節點SQL選擇XML節點屬性值
- 選擇節點值/查找/名在發現/查找/選定值= 「1」
- 選擇節點其中Findings/Finding/Selected Value =「1」的Findings/Finding/NoteText的值
將其放入存儲過程。我已經嘗試了至少三十個使用查詢,存在和值的版本。我可以得到所選值是否爲'1',但似乎無法在Select語句中分配相應的Name值。
SELECT
p.value('(Payments[1]/Payment[1]/PreAuthCertNumber)[1]', 'varchar(20)') AS PriorAuthNumber
,qa.value('(Name[1])','varchar(255)') AS Question
,qa.value('(Findings/Finding/Name)[1]','varchar(255)') AS Answer
FROM #ValueExample
CROSS APPLY XMLDocument.nodes('/OutboundDataFeed/Patient/PatientAdmission') as t(p)
CROSS APPLY XMLDocument.nodes('/OutboundDataFeed/Patient/PatientAdmission/CMAssessments/CMAssessment/Sections/Section/Questions/Question') as u(qa)
謝謝!
太棒了!非常感謝! – user2005792