select userid,
case when substring(consumpattr,0,2)='10' and substring(consumpsort,0,2)= '10' then '10'
when substring(consumpattr,0,2)='10' and substring(consumpsort,0,2)<>'10' then '20'
when substring(consumpattr,0,2)='20' and substring(consumpsort,0,2)<>'70' then '20'
when substring(consumpattr,0,2)='30' and substring(consumpsort,0,2)<>'70' then '70'
else '70' end as consumpattr
from busi.t_ar_userinfo