I am trying to fetch the data from a XML column. This is the query and below it is the xml column data
SELECT
[PQDAdvice].value('(/Advice//DORowData/PrimaryValue/node())[1]', 'nvarchar(max)') as PrimaryValue,
[PQDAdvice].value('(/Advice//DORowData/ListValue1/node())[1]', 'nvarchar(max)') as ListValue1
FROM
PatQD
WHERE
PQDPatID = '4c983bd8-da00-4395-80bb-a383b21313d5'
XML contents:
<Advice>
<DORowData>
<PrimaryValue>Diet and Nutrition</PrimaryValue>
<ListValue1>Advice</ListValue1>
</DORowData>
<DORowData>
<PrimaryValue>Salt Restriction</PrimaryValue>
<ListValue1>Advice</ListValue1>
</DORowData>
<DORowData>
<PrimaryValue>Water Consumption</PrimaryValue>
<ListValue1>Advice</ListValue1>
</DORowData>
</Advice>
The issue I am getting that only one column I am getting instead of all column
Primary |ListValue1
Diet and Nutrition |Advice
Instead of
Primary |ListValue1
Diet and Nutrition |Advice
Salt Restriction |Advice
Water Consumption |Advice