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

Hi,

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

Thanks

commented: If you don't know the answer means don't post, don't ask unnecessary questions -1

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.