Click to See Complete Forum and Search --> : SQL question for -- substr


Amy00
09-24-2003, 02:52 PM
Hi,

I want to get the last 3 characters of a string. How can I get it?

Thanks!

slimdave
09-24-2003, 02:54 PM
substr(length('ABCDEFG')-2,3), i would think.

Amy00
09-24-2003, 02:57 PM
Thanks, i got it.

jmodic
09-25-2003, 06:19 PM
Even more simple and straightforward:

substr('ABCDEFG',-3)

slimdave
09-25-2003, 06:37 PM
Originally posted by jmodic
Even more simple and straightforward:

substr('ABCDEFG',-3)

Oooooooooo!

You see if I read the documentation more often, I'd have known that.

DaPi
09-26-2003, 03:38 AM
Hi slimdave,
You've got to give it to Jurij, he's good. But don't let him know I said that, he might get big headed ;)