Westside2004
asked on
SQL Query against MariaDB Database with XML in column?
Hi,
I have the following XML in a column named "product_date" in my MySQL database:
'<values>
<value>Intel Core i7</value>
<value>Intel Core i5</value>
<value>AMD FX</value>
<value>AMD Ryzen</value>
<value>AMD A-Series</value>
<value>Phenon II X4 965</value>
<value>Qualcomm</value>
<value>Nvidia Tegra 4</value>
</values>
How can I query this column using SQL and return just the raw values with 1 value per row within the "value" node?
Final output would multiple rows with 1 value per row
Intel Core i7
Intel Core i5
AMD FX
etc
I have the following XML in a column named "product_date" in my MySQL database:
'<values>
<value>Intel Core i7</value>
<value>Intel Core i5</value>
<value>AMD FX</value>
<value>AMD Ryzen</value>
<value>AMD A-Series</value>
<value>Phenon II X4 965</value>
<value>Qualcomm</value>
<value>Nvidia Tegra 4</value>
</values>
How can I query this column using SQL and return just the raw values with 1 value per row within the "value" node?
Final output would multiple rows with 1 value per row
Intel Core i7
Intel Core i5
AMD FX
etc
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
More complex answer is that you could possibly do it with some potentially complex Stored Procedure.
The proper approach (which may or may not be feasible), is to store that data in a separate table and then query it using a join.
Alternatively, you could pull the data down using a scripting language such as PHP, and then parse out the results from there.