943,716 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 2346
  • MySQL RSS
Jun 2nd, 2009
0

How to remove extra spaces in a row??

Expand Post »
Hi,

I have a table like this:

MySQL Syntax (Toggle Plain Text)
  1.  
  2. name
  3. +------------------------------------+
  4. | name |
  5. +------------------------------------+
  6. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location. |
  7. +------------------------------------+
  8. 1 row IN SET (0.00 sec)

I want to remove extra space i.e in between binding and protein, desired and location, useful and this.

I tried with trim function but that didn't remove these spaces.

There should be only one space in between binding and protein, desired and location, useful and this.

Output should be like this:

MySQL Syntax (Toggle Plain Text)
  1.  
  2. SELECT * FROM remove;
  3.  
  4. +--------------------------------+
  5. | name |
  6. +--------------------------------+
  7. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location |
  8. +--------------------------------+
  9. 1 row IN SET (0.00 sec)

How can i remove extra spaces???

Any suggestions??

Regards
Vanditha
Last edited by Vandithar; Jun 2nd, 2009 at 6:41 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Vandithar is offline Offline
37 posts
since Aug 2008
Jun 2nd, 2009
-1

Re: How to remove extra spaces in a row??

Hi,

Could you copy and paste your code? Have you used any css?

Thanks
Reputation Points: 11
Solved Threads: 1
Newbie Poster
k8f1 is offline Offline
13 posts
since Nov 2007
Jun 2nd, 2009
0

Re: How to remove extra spaces in a row??

Click to Expand / Collapse  Quote originally posted by k8f1 ...
Hi,

Could you copy and paste your code? Have you used any css?

Thanks

Hi,

I am not using css!

This is the data i.e in my table.

MySQL Syntax (Toggle Plain Text)
  1. name
  2. +------------------------------------+
  3. | name |
  4. +------------------------------------+
  5. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location. |
  6. +------------------------------------+
  7. 1 row IN SET (0.00 sec)

I tried with trim function like this:

MySQL Syntax (Toggle Plain Text)
  1. UPDATE remove SET name = TRIM(name);

but didn't work!!!

How can i remove these spaces??


Regards
Vanditha
Reputation Points: 10
Solved Threads: 0
Light Poster
Vandithar is offline Offline
37 posts
since Aug 2008
Jun 2nd, 2009
0

Re: How to remove extra spaces in a row??

Click to Expand / Collapse  Quote originally posted by Vandithar ...
Hi,

I am not using css!

This is the data i.e in my table.

MySQL Syntax (Toggle Plain Text)
  1. name
  2. +------------------------------------+
  3. | name |
  4. +------------------------------------+
  5. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location. |
  6. +------------------------------------+
  7. 1 row IN SET (0.00 sec)

I tried with trim function like this:

MySQL Syntax (Toggle Plain Text)
  1. UPDATE remove SET name = TRIM(name);

but didn't work!!!

How can i remove these spaces??


Regards
Vanditha

Hi Vanditha

you are right when u used the trim it's not worked because trim is used only when the white space in left side or right side. so use regexp for this issue.

Regards
Saurav Prasad
Reputation Points: 10
Solved Threads: 0
Newbie Poster
saurav.prasad28 is offline Offline
11 posts
since Apr 2009
Jun 3rd, 2009
0

Re: How to remove extra spaces in a row??

Quote ...
Could you copy and paste your code? Have you used any css?
Quote ...
so use regexp for this issue.
Whats code got to do with it ? And what the hell is the css doing there in a question related to MySQL ? And how are you going to use regex Mr. ? If you don't know the answer don't post there's no point in pointing someone in the wrong direction or even asking unnecessary questions.

@OP : Use the REPLACE function in MySQL.
http://dev.mysql.com/doc/refman/5.0/en/replace.html
Reputation Points: 485
Solved Threads: 89
Posting Shark
verruckt24 is offline Offline
944 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: SQL Query Help Required
Next Thread in MySQL Forum Timeline: MySQL Importable file required for country and state





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC