From: Dan Nelson Date: March 31 2011 4:35pm Subject: Re: Parse text field from query List-Archive: http://lists.mysql.com/mysql/224737 Message-Id: <20110331163503.GB86392@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit In the last episode (Mar 31), Carlos Fernndez Iglesias said: > I have this field in a table from my database that contains a lot of > information and I would like to extract only a little bit of it. I have > to parse it but need to do it directly in the sql query, do you know what > kind of function I have to use, or how? Since your data is well-formed XML, you can use mysql's ExtractValue() function: mysql> select extractvalue(f,"/TEMPLATE/CPU") from t; +---------------------------------+ | extractvalue(f,"/TEMPLATE/CPU") | +---------------------------------+ | 1 | +---------------------------------+ 1 row in set (0.01 sec) See http://dev.mysql.com/doc/refman/5.5/en/xml-functions.html for more info. > This is an example of the field (i need the 1 in cpu data): > > | > > | -- Dan Nelson dnelson@stripped