update 表 set 列名 = REPLACE(列名,SUBSTRING(列名 , LOCATE( '(',列名) , LOCATE(')',列名)) ,被替换的字符)
replace
(column name, replaced string, replaced string): Replace part of the content in the string
substring
(column name, starting position, ending position): intercept a part of the string
locate
(searched string, column name): Find the position of a certain character in the string
eg:
select * from (select *,substring_index(substring_index(remarks,"[",1),']',-1) as carCard from test ) as t where carCard LIKE '%C999%'
The above is the detailed content of How to remove brackets and everything in brackets from a string in MySQL. For more information, please follow other related articles on the PHP Chinese website!