单独对x或者y或者x和y进行处理
代码如下
DROP FUNCTION SPLIT_STR;
CREATE FUNCTION SPLIT_STR(
x VARCHAR(255),
delim VARCHAR(12),
pos INT
)
RETURNS VARCHAR(255)
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
delim, '');
-- 修改x 减少50
update base_map_widget set points = replace(points,SPLIT_STR(points, ',', 1),SPLIT_STR(points, ',', 1)-50);
-- 修改y 减少50
update base_map_widget set points = replace(points,SPLIT_STR(points, ',', 2),SPLIT_STR(points, ',', 2)-50);
网友评论