Select Last N Characters of a Field

Using the substring function, this example below will select the leftmost 6 characters from a string field named “field_name” in the table tbl_stuff with mysql.

select substring(field_name,-6) as leftmost6 from tbl_stuff

Leave a Reply

Your email address will not be published. Required fields are marked *