PeopleSoft Adoption Made Smooth & Simple!
On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool. Claim Your Free WalkMe Account Now
SELECT o.OrderID AS "Order/OrderID", o.OrderNumber AS "Order/OrderNumber", o.BillToFirstName AS "Order/BillToFirstName", o.BillToLastName AS "Order/BillToLastName", (Select p.Amount from ac_Payments p where p.OrderID = o.OrderID FOR XML PATH ('')) AS "Order/Payments/Amount" FROM ac_Orders AS o INNER JOIN ac_OrderItems as oi ON o.OrderID = oi.OrderID WHERE o.OrderID=104 FOR XML PATH ('O'), ROOT ('Orders'), ELEMENTS;
<Orders> <O> <Order> <OrderID>104</OrderID> <OrderNumber>104</OrderNumber> <BillToFirstName>Jean</BillToFirstName> <BillToLastName>Denny</BillToLastName> <Payments> <Amount><Amount>39.4400</Amount></Amount> </Payments> </Order> </O> <Orders>
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Help with SQL joins||9||58|
|Urgent help needed! Unable to to paste in query designer||29||58|
|Need a SQL query that creates a header row and one or more detail rows.||7||133|
|How to create and use encrypted columns in SQL 2005?||15||63|
Join the community of 500,000 technology professionals and ask your questions.