954,190 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need update query--Remove the coma ","

Hi friends

Thanks for your repaly for all my question..
I need one update query. I have selected the datas are insert with coma ",".

Query
SELECT city
FROM `locations`
WHERE city REGEXP ','

I got the result..
Silver Spring,
Elkins,
PORTLAND,
Baltimore,

I need like this
Silver Spring
Elkins
PORTLAND
Baltimore

I need to remove the "," and restore the values .
Thanks
Vssp

vssp
Junior Poster
199 posts since Jul 2006
Reputation Points: 5
Solved Threads: 5
 

That's really more of an SQL thing. You may want to try posting there if you don't find your answer here.

It can be done in PHP, probably not as fast, though.
Run your query, parse the result set (Take a look at http://us2.php.net/manual/en/function.stripos.php ) and write the update query.

Puckdropper
Posting Pro
500 posts since Jul 2004
Reputation Points: 23
Solved Threads: 23
 

Hi thanks for your replay
This is the update query

UPDATE `locations` SET city = replace( city, ',', '' ) WHERE city LIKE '%,'

I just share with u


vssp
Junior Poster
199 posts since Jul 2006
Reputation Points: 5
Solved Threads: 5
 

I THINK YIU CAN USE str_replace

aarya
Junior Poster
139 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You