[xquery-talk] How to write this XQuery program?
Zhimao Guo
021021090 at fudan.edu.cn
Mon Sep 6 22:48:32 PDT 2004
Hi, all:
Now I have three XML files, c1.xml, c2.xml, c3.xml.
Each XML file contains information of one company, and of parts supplied by it.
Given a part id, I want to get the company which offered this part with the lowest price.
How can I write this XQuery?
-----begin of source data----
c1.xml:
<company>
<name>CompanyA</name>
<parts>
<part>
<id>p1</id>
<price>100</price>
</part>
<part>
<id>p2</id>
<price>101</price>
</part>
</parts>
</company>
c2.xml:
<company>
<name>CompanyB</name>
<parts>
<part>
<id>p2</id>
<price>105</price>
</part>
<part>
<id>p3</id>
<price>106</price>
</part>
</parts>
</company>
c3.xml:
<company>
<name>CompanyC</name>
<parts>
<part>
<id>p2</id>
<price>100</price>
</part>
<part>
<id>p6</id>
<price>106</price>
</part>
</parts>
</company>
-----end of source data----
-----begin of expected result----
<result>
<part>
<id>p2</id>
<price>100</price>
<company>CompanyC</company>
</part>
</result>
-----end of expected result----
Who would like to give me a hand? Thanks very much.
best regards,
-zhimao
More information about the talk
mailing list