user3749800
user3749800

Reputation: 93

Select Data from XML string in MYSQL

I am trying to select certain values that are posted back to our sql server from an xml into one field as a string..

Example:

<?XMLVERSION><result><id>0</id><response>success</response><did>B2A5DY53</did><price>0.00</price></result>

How would I select just the value between "price" ' ' "/price"?

Upvotes: 0

Views: 437

Answers (1)

Ike Walker
Ike Walker

Reputation: 65567

You can use the built-in ExtractValue() function for this:

SELECT ExtractValue('<result>
<id>0</id>
<response>success</response>
<did>B2A5DY53</did>
<price>0.00</price>
</result>', '/result/price')

Upvotes: 1

Related Questions