SQL Server Question - Query to XML -
alright, i've got query:
select orders.orderid, productid, unitprice, quantity, orders.orderdate [order details] left join orders on orders.orderid=[order details].orderid orders.orderid='10248' or orders.orderid = '10249' xml auto, elements;
and when execute gives following xml:
<orders> <orderid>10248</orderid> <orderdate>1996-07-04t00:00:00</orderdate> <order_x0020_details> <productid>11</productid> <unitprice>15.4000</unitprice> <quantity>12</quantity> </order_x0020_details> <order_x0020_details> <productid>42</productid> <unitprice>10.7800</unitprice> <quantity>10</quantity> </order_x0020_details> <order_x0020_details> <productid>72</productid> <unitprice>38.2800</unitprice> <quantity>5</quantity> </order_x0020_details> </orders> <orders> <orderid>10249</orderid> <orderdate>1996-07-05t00:00:00</orderdate> <order_x0020_details> <productid>14</productid> <unitprice>20.4600</unitprice> <quantity>9</quantity> </order_x0020_details> <order_x0020_details> <productid>51</productid> <unitprice>46.6400</unitprice> <quantity>40</quantity> </order_x0020_details> </orders>
which fine me, except i'd " <order_x0020_details> "
read " <order details> "
cannot figure out how this. suggestions? thanks
you should able alias [order details]
table in query.
select orders.orderid, productid, unitprice, quantity, orders.orderdate [order details] orderdetails left join orders on orders.orderid=orderdetails.orderid orders.orderid = '10248' or orders.orderid = '10249' xml auto, elements;
Comments
Post a Comment