开发者

MySQL Substring Grab all but last three characters

Basically, I am trying to find 开发者_运维百科the inverse of this command: substring(term, -3).


Try this:

SELECT SubStr(myColumn, 1, LENGTH(myColumn) - 3)
FROM MyTable

or

SELECT LEFT(myColumn, LENGTH(myColumn) - 3)
FROM MyTable


This should do it: SELECT SUBSTRING(term FROM 1 FOR LENGTH(term)-3)


If you need it to match in a where comparison you could use

WHERE somefield LIKE 'term___'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜