tags:

views:

19

answers:

2

Hi,

I have a column with values like "A001", "B002" AND "003", "004". I would like have this result :

SELECT column from myTable

+--------+
| column |
+--------+
| 001    |
| 002    |
| 003    |
| 004    |
+--------+

Is this possible ?

+2  A: 

If you're looking for the last 3 characters in your field,

SELECT SUBSTRING(column,-3) FROM myTable
Victor Nicollet
Thank you for response. My exemple was not signifiant...It could be A1000 or 1001 too !The easiest way would be to use regular expressions, but I think it is not possible on SELECT, is it ?
Erwan
A: 

Here is my solution :

SELECT TRIM(LEADING 'A' FROM (LEADING 'B' FROM `column`)) FROM my_table
Erwan