从文本中删除\ n \ r的SQL查询是什么? [英] What would be a sql query to remove \n\r from the text?
本文介绍了从文本中删除\ n \ r的SQL查询是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用MySQL.我的数据有一个名为text
的列,该列使用TEXT数据类型.
I am using MySQL. My data has a column called text
, which uses the TEXT data type.
此列中的每个记录都有几行.我想用sql查询删除所有新行.我该怎么办?
There are several newlines for each record in this column. I want to remove all new lines with a sql query. How can I do that?
推荐答案
尝试一下-
CREATE TABLE table1(column1 TEXT);
INSERT INTO table1 VALUES ('text1\r\ntext2
text3');
SELECT * FROM table1;
--------
text1
text2
text3
UPDATE table1 SET column1 = REPLACE(column1, '\r\n', '');
SELECT * FROM table1;
--------
text1text2text3
这篇关于从文本中删除\ n \ r的SQL查询是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文