How to get last 12 digits from a sting in MySQL?
        Posted  
        
            by Nick Gorbikoff
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Nick Gorbikoff
        
        
        
        Published on 2010-04-21T23:30:36Z
        Indexed on 
            2010/04/21
            23:33 UTC
        
        
        Read the original article
        Hit count: 273
        
Hello.
How would I get last 12 digits of a string using mysql?
Let's say I have a varchar field with a tracking number, that may be anywhere from 5 to 20 varchars long. But I only need to select last 12 digits or less if there are less.
so in a field = 12345678123456789012
I would only need to get what's in brackets
field = 12345678[123456789012]
I saw a few examples using mid, etc, but they dont' produce the desired result or I can't find an example that makes sense :-(
Thank you.
© Stack Overflow or respective owner