巴扎黑2017-04-17 13:37:37
MYSQL:
SELECT RIGHT(RTRIM(@Path), LOCATE('.',REVERSE(RTRIM(@Path))) - 1)
SQLSERVER:
SELECT RIGHT(RTRIM(@Path), CHARINDEX('.',REVERSE(RTRIM(@Path))) - 1)
Assume the @Path
placeholder is your field. Idea: To find the last character .
, reverse it and find the position of the first .
, and then go to the original string to intercept the characters after .
.
怪我咯2017-04-17 13:37:37
I don’t have MySQL at hand, but you can do this in Oracle:
select substr(PATH, instr(PATH, '.') + 1) from 表名
As for MySQL, you can just check if there are corresponding functions.