简体   繁体   English

使用mySQL删除括号中的所有内容

[英]Remove Everything In Brackets with mySQL

I have a mysql table and some of the elements from the field, "title" have "( some text)". 我有一个mysql表,字段中的某些元素“ title”为“(某些文本)”。 I want to remove the brackets portion of the text. 我想删除文本的方括号部分。

So 所以

blah blah (blah) would turn into blah blah 等等等等(blah)will be blah blah

How would I do this in SQL? 如何在SQL中执行此操作?

you can use the replace function in MySQL 您可以在MySQL中使用replace函数

select replace(replace(title,'(', ''),')','') as  title
from table 

http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_replace http://dev.mysql.com/doc/refman/5.5/zh-CN/string-functions.html#function_replace

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM