Menu

(Solved) : Write Select Statement Returns Xml Document Contains Invoices Invoices Table One Line Item Q37285008 . . .

Write a SELECT statement that returns an XML document thatcontains all of the invoices in the Invoices table that have morethan one line item. This document should include one element foreach of the following columns:

InvoiceNumber

InvoiceDate

InvoiceTotal

InvoiceLineItemDescription

InvoiceLineItemAmount

Hint: Below is the SQL part of the query that you should use sothat all you have to add is the XML part

SELECT InvoiceNumber, InvoiceDate, InvoiceTotal,InvoiceLineItemDescription AS ItemDescription,InvoiceLineItemAmount AS ItemAmount
FROM Invoices AS Invoice JOIN InvoiceLineItems AS LineItem
ON Invoice.InvoiceID = LineItem.InvoiceID
WHERE Invoice.InvoiceID IN (
SELECT InvoiceID
FROM InvoiceLineItems
GROUP BY InvoiceID
HAVING COUNT(*) > 1)
ORDER BY InvoiceDate

FOR XML RAW, ELEMENTS;

Save the XML document that is returned in a file namedMultipleLineItems.xml

Generate an XML schema for the file and save it in a file namedMultipleLineItems.xsd

How can I

Save the XML document that is returned in a file namedMultipleLineItems.xml and Generate an XML schema for the file andsave it in a file named MultipleLineItems.xsd ?

 

Expert Answer


Answer to Write a SELECT statement that returns an XML document that contains all of the invoices in the Invoices table that have …

OR