Reputation: 1
I'm trying to extract value from a column containing xml.
here's a snippet from my xml, where i want the value of "fieldscreen.id"
<action id="141" name="Abandonner" view="fieldscreen">
<meta name="issue.editable">false</meta>
<meta name="description">Abandonnée</meta>
<meta name="fieldscreen.id">10102</meta>
<restrict-to>
<conditions>
<condition type="class">
Please help me with the sql where i get only the value of fieldscreen.id from the column. Database- mysql
Upvotes: 0
Views: 1334
Reputation: 42728
set @xml:='<action id="141" name="Abandonner" view="fieldscreen">\n<meta name="issue.editable">false</meta>\n<meta name="description">Abandonnée</meta>\n<meta name="fieldscreen.id">10102</meta>\n</action>';
SELECT ExtractValue(@xml, 'action/meta[@name="fieldscreen.id"]');
| ExtractValue(@xml, 'action/meta[@name="fieldscreen.id"]') | | :-------------------------------------------------------- | | 10102 |
db<>fiddle here
Upvotes: 2