parentProblem 要素の直接の子ではない、空の組織要素を見つけたいと思います。
そのようです..
select * from Audit.PatientAudit pa
where pa.BeforeXml.exist('//*:organisation[not(../*:parentProblem)]') = 1
しかし、それはうまくいかないようです、何かアイデアはありますか?
parentProblem 要素の直接の子ではない、空の組織要素を見つけたいと思います。
そのようです..
select * from Audit.PatientAudit pa
where pa.BeforeXml.exist('//*:organisation[not(../*:parentProblem)]') = 1
しかし、それはうまくいかないようです、何かアイデアはありますか?
declare @T table(BeforeXml xml)
insert into @T values
('<root>
<parentProblem>
<organisation/>
</parentProblem>
</root>'),
('<root>
<anotherProblem>
<organisation/>
</anotherProblem>
</root>'),
('<root>
<anotherProblem>
<organisation ID="1"/>
</anotherProblem>
</root>')
select *
from @T pa
where pa.BeforeXml.exist('//organisation[local-name(..)!="parentProblem" and count(@*)=0]') = 1