0
나는이 두 xml 파일xquery를 사용하여 다른 xml 파일의 값을 비교하는 방법은 무엇입니까?
cars.xml
<cars>
<manufacturer>
<model modelID="1">
</model>
<model modelID="2">
</model>
<model modelID="3">
</model>
</manufacturer>
<manufacturer>
<model modelID="4">
</model>
<model modelID="5">
</model>
<model modelID="6">
</model>
</manufacturer>
</cars>
와라는 파일 price.xml :
<price>
<model modelID="1">
<price>1000</price>
</model>
<model modelID="2">
<price>3000</price>
</model>
<model modelID="3">
<price>2000</price>
</model>
<model modelID="4">
<price>2000</price>
</model>
<model modelID="5">
<price>100</price>
</model>
<model modelID="6">
<price>5000</price>
</model>
</price>
내가 수행 할 쿼리는 그 모든 제조 업체에 대한 cars.xml, 나는 가장 비싼 모델의 modelID를 반환하고 싶지만, 나는 그것을 이해할 수 없다.
for $manf in doc("cars.xml")//manufacturer
let $p := doc("price.xml")
where $manf/model/@modelID = $p/model/@modelID
and $p/model/price = (for $m in doc("cars.xml")//manufacturer
return max(for $pr in doc("price.xml")
where $m/model/@modelID = $pr/model/@modelID
return data($pr/model/price)))
return data($manf/model/@modelID)
내가 어디 가까운 오른쪽에있어 알고 있지만, 기본적으로 내가해야 할 일을 모든 제조 업체입니다하지 않습니다 그 modelID의에를 어떻게 든 사용
는 내가 시도한 것은 이것이다 어떤 모델이 가장 비쌉니까?
당신은 http://try.zorba.io/queries/xquery/y8iT3K0nSVTHqh0wvHx7pzk3xpQ%3D 라이브를 시도 할 수 있습니다 – wcandillon