3
數
我想指望類似「itemid_ref」,讓每個項目的數量REF在此:GROUP BY和XQuery中
<?xml version="1.0" encoding="utf-8"?>
<electrystore>
<itembill>
<itembill_id>1</itembill_id>
<itemid_ref>2</itemid_ref>
<billid_ref>2</billid_ref>
<price>20000</price>
</itembill>
<itembill>
<itembill_id>2</itembill_id>
<itemid_ref>3</itemid_ref>
<billid_ref>3</billid_ref>
<price>250000</price>
</itembill>
<itembill>
<itembill_id>3</itembill_id>
<itemid_ref>3</itemid_ref>
<billid_ref>3</billid_ref>
<price>30000</price>
</itembill>
<itembill>
<itembill_id>4</itembill_id>
<itemid_ref>1</itemid_ref>
<billid_ref>2</billid_ref>
<price>140000</price>
</itembill>
<itembill>
<itembill_id>5</itembill_id>
<itemid_ref>2</itemid_ref>
<billid_ref>1</billid_ref>
<price>10000</price>
</itembill>
</electrystore>
我想從XQuery的輸出是這樣的:
<?xml version="1.0" encoding="UTF-8"?>
<results>
<result>
<itemid_ref>
2
</itemid_ref>
<numberOfitemes>2</numberOfitemes>
</result>
<result>
<itemid_ref>
3
</itemid_ref>
<numberOfitemes>2</numberOfitemes>
</result>
<result>
<itemid_ref>
1
</itemid_ref>
<numberOfitemes>1</numberOfitemes>
</result>
我該怎麼做?
是它的工作原理:) 非常感謝你和關於XQuery 3.0的說明 – user3076314