How to get the last 12 digits of a string using mysql?
Let's say I have a varchar field with a tracking number, which can be 5 to 20 varchars. But I need to select only the last 12 digits or less, if there are less.
therefore in field = 12345678123456789012
I would only need to get what is in brackets
field = 12345678[123456789012]
I saw several examples using mid, etc., but they do not give the desired result, or I can not find an example that makes sense :-(
Thanks.
source share