原来:aa–bb–cc
截取后:aa–bb
select reverse(substring(reverse(字段),CHARINDEX(’–’,reverse(字段))+2 ,LEN(字段) )) from table where 条件=‘abc’
--取反
select progressrecord from o_ptaskplan_progress
--2021-04-27 3%;2021-04-27 5%;2021-04-28 51%;2021-06-29 52%;2021-06-29 53%;
select reverse(progressrecord) from o_ptaskplan_progress
--;%35 92-60-1202;%25 92-60-1202;%15 82-40-1202;%5 72-40-1202;%3 72-40-1202
--去掉所有 ;
select replace(progressrecord , ';','') from o_ptaskplan_progress
--2021-04-27 3%2021-04-27 5%2021-04-28 51%2021-06-29 52%2021-06-29 53%