[英]Replace substring with wildcard in MySQL
I'm trying to write an SQL update to replace a specific CSS property with a blank so I can remove it. 我正在尝试编写SQL更新,以将特定的CSS属性替换为空白,以便将其删除。
Let's see: 让我们来看看:
UPDATE table
SET css_string = REPLACE(css_string, "top:calc(50%%ANY_VALUE%%) !important;", " ");
So that I can remove the top:calc(50% - 20px) !important;
这样我就可以删除top:calc(50% - 20px) !important;
property from the CSS string. CSS字符串中的属性。
I'll take a stab at it, been a while since I have worked with SQL: 自从我使用SQL以来已经有一段时间了,我将对此进行介绍:
UPDATE table
SET css_string = REPLACE(css_string,"top:calc(50%) !important;"," ");
Before you go updating you can run some queries like: 在进行更新之前,您可以运行一些查询,例如:
Select css_string, REPLACE(css_string,"top:calc(50%) !important;"," ") as "change to" from table
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.