简体   繁体   中英

How to substring from a certian index to the end in SQL

I want to get the substring from eg START=3 to the end of the string.

Str
stringExample
anotherStringExample

I need something like this:

SUBSTR(str, 3, `**end**`)

and the output should be:

Str
ringExample
otherStringExample

You can try this query

select SUBSTR(Str,3,LENGTH(Str)-3+1) as Str;

or

select SUBSTR(Str,3) as Str;

substr function w3schools link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM