In SQL Server 2014, I have the following xml fragment :
<salesorder>
<ordnum>123</ordnum>
<orddate>2017-04-17</orddate>
<details>
<detail>
<itemtype>Stationery</itemtype>
<itemdesc>Pencil</itemdesc>
<specifications>
<specification>
<name>Qty</name>
<value>5</value>
</specification>
<specification>
<name>Description</name>
<value>Pencil H1</value>
</specification>
<specification>
<name>Price</name>
<value>1.50</value>
</specification>
</specifications>
</detail>
<detail>
<itemtype>Stationery</itemtype>
<itemdesc>Pencil</itemdesc>
<specifications>
<specification>
<name>Qty</name>
<value>10</value>
</specification>
<specification>
<name>Description</name>
<value>Pencil H2</value>
</specification>
<specification>
<name>Colour</name>
<value>Red</value>
</specification>
<specification>
<name>Price</name>
<value>2.75</value>
</specification>
</specifications>
</detail>
</details>
</salesorder>
I would like to extract the following data :
ordnum itemtype qty price
123 Stationery 5 1.50
123 Stationery 10 2.75
Is this possible to accomplish in T-SQL?
Thanks in advance, MP