mysql 截取字符串中的数字

mysql 截取字符串中的数字,第1张

    select  REVERSE(right(REVERSE(filename),length(filename)-LEAST(

    if(Locate('0',REVERSE(filename)) >0,Locate('0',REVERSE(filename)),999),

    if(Locate('1',REVERSE(filename)) >0,Locate('1',REVERSE(filename)),999),

    if(Locate('2',REVERSE(filename)) >0,Locate('2',REVERSE(filename)),999),

    if(Locate('3',REVERSE(filename)) >0,Locate('3',REVERSE(filename)),999),

    if(Locate('4',REVERSE(filename)) >0,Locate('4',REVERSE(filename)),999),

    if(Locate('5',REVERSE(filename)) >0,Locate('5',REVERSE(filename)),999),

    if(Locate('6',REVERSE(filename)) >0,Locate('6',REVERSE(filename)),999),

    if(Locate('7',REVERSE(filename)) >0,Locate('7',REVERSE(filename)),999),

    if(Locate('8',REVERSE(filename)) >0,Locate('8',REVERSE(filename)),999),

    if(Locate('9',REVERSE(filename)) >0,Locate('9',REVERSE(filename)),999)

  )+1)),filename

   from homework

select REVERSE(right(REVERSE(filename),length(filename)-LEAST(

if(Locate('0',REVERSE(filename)) >0,Locate('0',REVERSE(filename)),999),

if(Locate('1',REVERSE(filename)) >0,Locate('1',REVERSE(filename)),999),

if(Locate('2',REVERSE(filename)) >0,Locate('2',REVERSE(filename)),999),

if(Locate('3',REVERSE(filename)) >0,Locate('3',REVERSE(filename)),999),

if(Locate('4',REVERSE(filename)) >0,Locate('4',REVERSE(filename)),999),

if(Locate('5',REVERSE(filename)) >0,Locate('5',REVERSE(filename)),999),

if(Locate('6',REVERSE(filename)) >0,Locate('6',REVERSE(filename)),999),

if(Locate('7',REVERSE(filename)) >0,Locate('7',REVERSE(filename)),999),

if(Locate('8',REVERSE(filename)) >0,Locate('8',REVERSE(filename)),999),

if(Locate('9',REVERSE(filename)) >0,Locate('9',REVERSE(filename)),999)

)+1)),filename

from homework


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6171507.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-17
下一篇 2023-03-17

发表评论

登录后才能评论

评论列表(0条)

保存