展开全部
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