慕神8447489
我优先考虑过正则表达式来解决问题,但发现mysql不支持反向引用REGEXP:AAAA:([0-9])\1{3}ABBA:([0-9])([0-9])\2\1AABB:([0-9])\1([0-9])\2所以放弃正则后只能用最原始的if else方式,当然mysql的实现要变成case when thenUPDATE temp t SET t.`price`=
CASE WHEN (SUBSTRING(t.`number`,1,1)=SUBSTRING(t.`number`,2,1) AND
SUBSTRING(t.`number`,1,1)=SUBSTRING(t.`number`,3,1) AND SUBSTRING(t.`number`,1,1)=SUBSTRING(t.`number`,4,1))=TRUE
THEN 100 WHEN (SUBSTRING(t.`number`,1,1)=SUBSTRING(t.`number`,2,1) ANDSUBSTRING(t.`number`,3,1)=SUBSTRING(t.`number`,4,1) AND SUBSTRING(t.`number`,2,1)<>SUBSTRING(t.`number`,3,1))=TRUE
THEN 50WHEN (SUBSTRING(t.`number`,1,1)=SUBSTRING(t.`number`,4,1) ANDSUBSTRING(t.`number`,2,1)=SUBSTRING(t.`number`,3,1) AND SUBSTRING(t.`number`,1,1)<>SUBSTRING(t.`number`,2,1))=TRUE
THEN 40ELSE 0 END;