有mysql路径字段,
E:\code-py-download\价\图片\2021005017\3\3-68590-8915ad8329a942f38fcb74306212a067-0.png
如何取最后一个 \ 前面部分?
SELECT LOCATE('\\',path_names_png),path_names_png FROM `yfyj` select substring_index(path_names_png,'\\',-1) from yfyj SELECT SUBSTRING_INDEX('and_this_may_go_like_this_too', '_', -1); length对中文长度不好 SELECT path_names_png, LEFT(path_names_png, LENGTH(path_names_png) - LOCATE('\\', REVERSE(path_names_png))) from yfyj
char_length中文长度OK SELECT path_names_png, LEFT(path_names_png, char_length(path_names_png) - LOCATE('\\', REVERSE(path_names_png))) from yfyj
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步