how to trim leading zeros from alphanumeric text in mysql function

Viewed 103159

What mysql functions are there (if any) to trim leading zeros from an alphanumeric text field?

Field with value "00345ABC" would need to return "345ABC".

8 Answers

You are looking for the trim() function.

Alright, here is your example

SELECT TRIM(LEADING '0' FROM myfield) FROM table

I believe you'd be best off with this:

SELECT TRIM(LEADING '0' FROM myField)

simply perfect:

SELECT TRIM(LEADING '0' FROM myfield) FROM table
Related