0

Hi,

I have a table like this:

name
+------------------------------------+
| name                               |
+------------------------------------+
| This is an rna-binding     protein. The data which is useful       is available from the desired             location.  |
+------------------------------------+
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:

select * from remove;

+--------------------------------+
| name                           |
+--------------------------------+
| This is an rna-binding protein. The data which is useful is available from the desired location |
+--------------------------------+
1 row in set (0.00 sec)

How can i remove extra spaces???

Any suggestions??

Regards
Vanditha

4
Contributors
4
Replies
6
Views
8 Years
Discussion Span
Last Post by verruckt24
-1

Hi,

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

Thanks

Votes + Comments
If you don't know the answer means don't post, don't ask unnecessary questions
0

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.

name
+------------------------------------+
| name                               |
+------------------------------------+
| This is an rna-binding     protein. The data which is useful       is available from the desired             location.  |
+------------------------------------+
1 row in set (0.00 sec)

I tried with trim function like this:

update remove set name = trim(name);

but didn't work!!!

How can i remove these spaces??


Regards
Vanditha

0

Hi,

I am not using css!

This is the data i.e in my table.

name
+------------------------------------+
| name                               |
+------------------------------------+
| This is an rna-binding     protein. The data which is useful       is available from the desired             location.  |
+------------------------------------+
1 row in set (0.00 sec)

I tried with trim function like this:

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

0

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

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.