2013-03-22 72 views
0
Based on our stats gathered across the U.S.  95%  of Flight Department Managers were males while  95%  were females. 

我已经有几个wordpress帖子这个句子,飞行部门经理显然是这里的动态因素。MYSQL查询查找和替换所有帖子上的动态词组

我需要做的是将第一个95%替换为%5,但仅限于在此句子中男性和女性都有95%的帖子。

所以上面的句子应改为

Based on our stats gathered across the U.S.  5%  of Flight Department Managers were males while  95%  were females. 

回答

0

您可以编写类似:

UPDATE table_name 
    SET column_name = REPLACE(column_name, ' U.S.  95% ', ' U.S.  5% ') 
WHERE column_name REGEXP ' 95% .* 95% ' 
;