Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

for $item in PurchaseOrders/PurchaseOrder/item let $d := $item/@partid return ($item/partid, $item/quantity * $item/price) The above command returns me 100-100-01 29.97 100-103-01 249.95000000000002 100-101-01 19.99 100-103-01

for $item in PurchaseOrders/PurchaseOrder/item let $d := $item/@partid

return ($item/partid, $item/quantity * $item/price)

The above command returns me

100-100-01 29.97 100-103-01 249.95000000000002 100-101-01 19.99 100-103-01 99.98 100-201-01 3.99 100-100-01 29.97 100-101-01 99.94999999999999 100-201-01 19.950000000000003 100-100-01 9.99 100-100-01 39.96 100-103-01 99.98 100-100-01 29.97 100-101-01 99.94999999999999 100-201-01 19.950000000000003

I want that all same part-id do add up

i.e. 100-100-01 139.86 ...

What changes should I make in my Xquery ?

Input File

PurchaseOrder.xml

   100-100-01 Snow Shovel, Basic 22 inch 3 9.99   100-103-01 Snow Shovel, Super Deluxe 26 inch 5 49.99     100-101-01 Snow Shovel, Deluxe 24 inch 1 19.99   100-103-01 Snow Shovel, Super Deluxe 26 inch 2 49.99   100-201-01 Ice Scraper, Windshield 4 inch 1 3.99     100-100-01 Snow Shovel, Basic 22 inch 3 9.99   100-101-01 Snow Shovel, Deluxe 24 inch 5 19.99   100-201-01 Ice Scraper, Windshield 4 inch 5 3.99     100-100-01 Snow Shovel, Basic 22 inch 1 9.99     100-100-01 Snow Shovel, Basic 22 inch 4 9.99   100-103-01 Snow Shovel, Super Deluxe 26 inch 2 49.99     100-100-01 Snow Shovel, Basic 22 inch 3 9.99   100-101-01 Snow Shovel, Deluxe 24 inch 5 19.99   100-201-01 Ice Scraper, Windshield 4 inch 5 3.99   

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

IT Auditing And Sarbanes Oxley Compliance Key Strategies For Business Improvement

Authors: Dimitris N. Chorafas

1st Edition

036738650X, 978-0367386504

More Books

Students also viewed these Accounting questions