Extracting only numbers from data in mysql query In mysql table, the data has special characters (.) and (_) mainly next to numbers. I'd like to extract only the numbers stripping the characters in mysql query. My current query is like this:

 $query = "SELECT Date, Tenext FROM tbdata"; 


In this query, I need this only for the second field name (Tenext).
How can I do this in the mysql query? any help is appreciated. Thanks!
You can use the TRIM function, for example:

mysql&gt; SELECT TRIM(BOTH '_' FROM '_21_' );
21


So in your case, to remove all _ characters, you can use something like:

 $query = "SELECT Date, TRIM(BOTH '_' FROM Tenext) as Tenext FROM tbdata";