I can loop through all of the rows in a php script and do Show
and trim can remove \n But I was just wondering if something same could be done in one query?
will it work? I can then just execute this query without requiring to loop through! thanks (PS: I could test it but table is quite large and dont want to mess with data, so just thought if you have tested something like this before)
V G 18.6k6 gold badges49 silver badges87 bronze badges asked Oct 1, 2009 at 16:19
TigerTigerTigerTiger 10.4k13 gold badges56 silver badges72 bronze badges 4
worked for me. while its similar, it'll also get rid of \r\n http://lists.mysql.com/mysql/182689 answered Jul 24, 2012 at 8:30
Łukasz RysiakŁukasz Rysiak 2,7901 gold badge21 silver badges19 bronze badges 4 your syntax is wrong:
Addition: If the newline character is at the start of the field:
John M 13.7k29 gold badges89 silver badges139 bronze badges answered Oct 1, 2009 at 16:23
2 1) Replace all new line and tab characters with spaces. 2) Remove all leading and trailing spaces.
answered Dec 11, 2013 at 18:54
GeoGeo 12.4k4 gold badges37 silver badges55 bronze badges 0
Above is working for fine.
Anptk 1,1212 gold badges17 silver badges28 bronze badges answered Jun 1, 2015 at 8:07
1 Removes trailing returns when importing from Excel. When you execute this, you may receive an error that there is no WHERE; ignore and execute.
answered Jun 17, 2015 at 22:41
UlysnepUlysnep 3854 silver badges12 bronze badges
answered Oct 2, 2009 at 10:44
RisseRisse 4831 gold badge4 silver badges8 bronze badges 1 Playing with above answers, this one works for me
answered May 12, 2020 at 22:07
jay_mzirayjay_mziray 3012 silver badges8 bronze badges My 2 cents. To get rid of my \n's I needed to do a \\n. Hope that helps someone.
answered Feb 13, 2017 at 0:16
For new line characters
For all white space characters
Read more: MySQL TRIM Function answered Feb 11, 2020 at 3:36
How do I delete an extra line in MySQL?The Trim() function is used to remove new line characters from data rows in MySQL.
How do I find a new line character in MySQL?Finding line break and carriage return (\r\n) in MySQL.
What method is used to remove newlines from the MySQL data Python?Method 2: Use the strip() Function to Remove a Newline Character From the String in Python. The strip() method in-built function of Python is used to remove all the leading and trailing spaces from a string. Our task can be performed using strip function() in which we check for “\n” as a string in a string.
How do I remove a specific character from a string in MySQL?Remove characters from string using TRIM()
TRIM() function is used to remove any character/ whitespace from the start/ end or both from a string.
|